I am trying to write a program that will allow a user to use a button to toggle the color or the text in a text box between blue and green. Any ideas?

Here is what I have so far:

[Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
if
TextBox1.ForeColor = Color.DarkRed
Else
TextBox1.ForeColor = Color.Blue
End If

End Sub]

I am trying to write a program that will allow a user to use a button to toggle the color or the text in a text box between blue and green. Any ideas?

Here is what I have so far:

[Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
if
TextBox1.ForeColor = Color.DarkRed
Else
TextBox1.ForeColor = Color.Blue
End If

End Sub]

Figured it out... here it is...

If TextBox1.ForeColor = Color.Red Then
TextBox1.ForeColor = Color.Black
Else
TextBox1.ForeColor = Color.Red
End If

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.