Walk Lightly on this PLANET and yet leave such a FOOTPRINT that cannot be erased for thousands of Years..!!!
Visit Codstech for Cyber Security related Posts !

Visitors

Saturday, July 23, 2011

VB-56 : Change the background color of the form

Write an event procedure to change the background color of the form by selecting one of 3 color options.
(Note : Use control array with 3 option buttons)


(Refer another type of colour changing program "Colour changing using Timer" and Changing Color as per the entered Number)



(A)Program Design : 



(B) Property(Controls Used) :
  • One Label to Entitle the program "Select Form's Background color"
  • 3 OptionButtons(Captions as Red,Green & Blue) with name Option1 (Same name creates a control array with index 0,1 & 2 .That is the name of the OptionButtons are : Option1(0),Option1(1) and Option1(2)
  • Form name is Form1




(C) Attaching Code to the Object :

Private Sub Option1_Click(Index As Integer)
Select Case Index
Case 0
Form1.BackColor = vbRed
Case 1
Form1.BackColor = vbGreen
Case 2
Form1.BackColor = vbBlue
End Select
End Sub


(D) Output :


(have any error in output ?)
====================================================================
=========================================================

No comments: