set forecolor?

habu ajuji

New member
Joined
Sep 15, 2011
Messages
2
Programming Experience
1-3
I want the rdbcorrect.forecolor=color.green but is not working out for me.
Public Sub VerifyAnswer(ByVal rdb As RadioButton)
If rdb.Text = rdbCorrect.Text Then
rdb.ForeColor = Color.Green
BtnGood.Show()
MyScore()
End If
If rdb.Text <> rdbCorrect.Text Then
rdb.ForeColor = Color.Red
BtnFail.Show()
rdbCorrect.ForeColor = Color.Green
End If


End Sub
 
hi you need to simply redo that code as u have

'Equals the rdbCorrect
If rdb.Text = rdbCorrect.Text Then

'Greather than and Less than the text
If rdb.Text <> rdbCorrect.Text Then

what im trying to say is your testing the same text 2 times when you would only need the "Equals" to text here's a sample...


Private Sub Button2_Click_1(sender As System.Object, e As System.EventArgs) Handles Button2.Click
'Declaring the Varible
Dim txtExample As String = "Answer"
'If statement to check if answer is Correct
If txtExample = "Answer" Then
'RadioButton Green for correct Answer
RadioButton1.ForeColor = Color.Green
'Else if Answer is InCorrect do following
Else
'RadioButton Green for InCorrect Answer
RadioButton1.ForeColor = Color.Red
'Ends if statement
End If
'Ends Declaration
End Sub
in this example the button click will allways be correct as it isn't changes, but when you change "Answer" to a TextBox then the answer can be what ever the user enters, then the button click or RadioButton selected will determin TextBox Answer to the Stored Answer and give Result!.
 
I appreciate ur concern Mr. proteknickz the problem is when the user choose a wrong answer i set the forecolor to red , this working out fine, but at the same i want to show the correct anawer by setting the correct answer forecolor to green or any color apart from red. I need assistance thanks

Public Sub VerifyAnswer(ByVal rdb As RadioButton)
Dim Correct As String = rdbCorrect.Text
If rdb.Text = Correct Then
rdbCorrect.ForeColor = Color.Green
BtnGood.Show()
MyScore()
Else
rdb.ForeColor = Color.Red
BtnFail.Show()
rdbCorrect.ForeColor = Color.Green

End If
 
Back
Top