How to Create a Program in VB to Change Text Colour?

with No Comments

Do you want to insert text colour in visual basic? So now we are going to tell you how to create a program in VB to Change Text Colour.


Text Color Program

To know how to do text colour program in visual basic just follow these steps carefully which are showing below.

Step 1: –

  • At first open Visual Basic0 application software
  • Then click on or select ‘Standard EXE’ icon from New Project dialogue box
  • Then click on ‘Open’.

Step 2: –

         Form Design: –

Select necessary Control Tool from Tool Box and adjust the position to ‘Form Window’: –

  • One TextBox
  • Five Command Box

text-color-program

Step 3: –

Properties Settings: –

  • Select ‘Form1’from Form Window and select ‘Caption’ from Properties Window
  • Then replace ‘Form1’ to ‘Text Color’ from properties window
  • Then select ‘Text1 box’ from Form Window and select ‘Text’ from Properties Window
  • Then remove or erase ‘Text1’ from Properties Window
  • Then select ‘Command1 box’ from Form Window and select ‘Caption’ from Properties Window
  • Then replace ‘Command1’ to ‘RED’ from Properties Window.
  • Then select ‘Command 2 box’ from Form Window and select ‘Caption’ from Properties Window
  • Then replace ‘Command 2’ to ‘GREEN’ from Properties Window.
  • Then select ‘Command 3 box’ from Form Window and select ‘Caption’ from Properties Window
  • Then replace ‘Command 3’ to ‘BLUE’ from Properties Window.
  • Then select ‘Command 4 box’ from Form Window and select ‘Caption’ from Properties Window
  • Then replace ‘Command 4’ to ‘CLEAR’ from Properties Window.
  • Then select ‘Command 5 box’ from Form Window and select ‘Caption’ from Properties Window
  • Then replace ‘Command 5’ to ‘EXIT’ from Properties Window.

text color project
text-color-program

text-color-program

text-color-program

 

Step 4: –

         Code Writing:-

  • Double click on ‘RED button’ or ‘Command 1 box’
  • Then input code to Command 1 code box

Code: – Text1.Forecolor=vbRed

  • Then double click on ‘GREEN button’ or ‘Command 2 box’
  • Then input code to Command 2 code box.

Code: – Text1.Forecolor=vbGreen

  • Then double click on ‘BLUE button’ or ‘Command 3 box’
  • Then input code to Command 3 code box.

Code: – Text1.Forecolor=vbBlue

  • Then double click on ‘CLEAR button’ or ‘Command 4 box’
  • Then input code to Command 4 code box.

Code: – Text1.Text = “”

  • Then double click on ‘EXIT button’ or ‘Command 5 box’
  • Then input code to Command 5 code box.

Code: – End

text-color-program

  • Then close code box

Step 5: –

Project Save: –

  • Click on ‘Save project’ option from File menu
  • Then input any name to file name box and click on Save option from Save file as box
  • Then input any new name to file name box
  • Then click ‘Save’ option.

Step 6: –

Project Run:

  • Press F5 key from keyboard or click on ‘Start’ from ‘Run menu’ for run the project
  • Then Type “AMERICA” to ‘Text 1 box’
  • Then click on ‘RED’ button.
  • Then click on ‘GREEN’ button.
  • Then click on ‘BLUE’ button.

text-color-program

  • Then click on ‘Clear button’ for clear the TextBox.
  • Then click on ‘Exit Button’ for close the result window.

This is the simple way to create a program in VB to insert text colour. Now you can easily make it.







Related Posts:

Leave a Reply