4.
Program to change the forecolor of text in editor window according
to color selected from option button
Design View:
Source Code:
Private Sub optblack_Click()
txteditor.ForeColor = vbBlack
End Sub
Private Sub optblue_Click()
txteditor.ForeColor = vbBlue
End Sub
Private Sub optgreen_Click()
txteditor.ForeColor = vbGreen
End Sub
Private Sub optred_Click()
txteditor.ForeColor = vbRed
End Sub
Private Sub optwhite_Click()
txteditor.ForeColor = vbWhite
End Sub
Private Sub Cmdend_Click()
Unload Me
End Sub
Output:
Viva Questions
1. What is role of option button?
Ans: It is used to select single option from multiple options.
2. What is the use of forecolor?
Ans: It is used to change the text color.