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)
(have any error in output ?)
(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 :
====================================================================
No comments:
Post a Comment