Friday, 31 August 2012

VB - Check Box, Option Button and Frame


Step1: Place One Label, one Text Box, Two Frames, Two Option Buttons, Three Check Boxes and a Command Button on the Form1
Step2: Rename the Control Caption in the Property Window as follows
Form1 -> Option & Check
Label1 -> Enter Text Here:
Frame1 -> Case
Frame2 -> Effects
Option1 -> Upper
Option2 -> Lower
Check1 -> Strike Through
Check2 -> Under Line
Check3 -> Bold
Command1 -> Exit
Change the Text1 Properties as multiline True and ScrollBars as Both
Enter the following codes in the corresponding controls
Private Sub Check1_Click()
If Check1.Value = 1 Then
Text1.Font.Strikethrough = True
Else
Text1.Font.Strikethrough = False
End If
End Sub

Private Sub Check2_Click()
If Check2.Value = 1 Then
Text1.Font.Underline = True
Else
Text1.Font.Underline = False
End If
End Sub

Private Sub Check3_Click()
If Check3.Value = 1 Then
Text1.Font.Bold = True
Else
Text1.Font.Bold = False
End If
End Sub

Private Sub Command1_Click()
End
End Sub

Private Sub Form_Load()
Option2.Value = True
End Sub

Private Sub Option1_Click()
If Option1.Value = True Then
 Text1.Text = UCase(Text1)
 End If
 End Sub

Private Sub Option2_Click()
If Option2.Value = True Then
Text1.Text = LCase(Text1)
End If
End Sub

 Step3: Run the Application by pressing F5

No comments:

Post a Comment