Option button in visual basic 6.0
How to write a program for option button in vb6
- First, create a new form
- Then draw some option buttons
- After that apply the source code for a specific option button
- Then run the program and check the option button operations
Source code for visual basic option button program
Private Sub chkb_Click()
If chkb.Value = 1 Then
txtnm.FontBold = True
Else
txtnm.FontBold = False
End If
End Sub
Private Sub chku_Click()
If chku.Value = 1 Then
txtnm.FontUnderline = True
Else
txtnm.FontUnderline = False
End If
End Sub
Private Sub chki_Click()
If chki.Value = 1 Then
txtnm.FontItalic = True
Else
txtnm.FontItalic = False
End If
End Sub
Private Sub Option1_Click()
If Option1.Value = True Then
txtnm.ForeColor = vbRed
End If
End Sub
Private Sub Option2_Click()
If Option2.Value = True Then
txtnm.ForeColor = vbBlue
End If
End Sub
Private Sub Option3_Click()
If Option3.Value = True Then
txtnm.ForeColor = vbGreen
End If
End SubHow option button works in Visual Basic?
Conclusion:
In this post, I have tried to give a better solution for how to use the option button in visual basic 6.0. Here using this program you can perform string operations through option buttons. This program is used for developing dynamic projects where you are used the option buttons. Here I have given the simple source code for the visual basic option button program.
0 Comments