954,517 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How Vb.NET Textbox background color change when TabStop come?

I have 3 textbox. I want to change Background color when cursor go there, other wise there will be no change.
How can i do this?

My mail address [EMAIL="pretom82@hotmail.com"]pretom82@hotmail.com[/EMAIL]

pretom
Newbie Poster
1 post since Jun 2006
Reputation Points: 10
Solved Threads: 0
 

Try this:

Private Sub ChangeBackcolorRed(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.MouseEnter, TextBox2.MouseEnter, TextBox3.MouseEnter
        sender.backcolor = Color.Blue
    End Sub

    Private Sub ChangeBackcolorWhite(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.MouseLeave, TextBox2.MouseLeave, TextBox3.MouseLeave
        sender.backcolor = Color.White
    End Sub
waynespangler
Posting Pro in Training
461 posts since Dec 2002
Reputation Points: 84
Solved Threads: 58
 

VB.NET Syntax (Toggle Plain Text)
Private Sub ChangeBackcolorRed(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.Enter, TextBox2.Enter, TextBox3.Enter
sender.backcolor = Color.Blue
End Sub

Private Sub ChangeBackcolorWhite(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.Leave, TextBox2.Leave, TextBox3.Leave
sender.backcolor = Color.White
End Sub

Gopinathv
Newbie Poster
1 post since Jun 2011
Reputation Points: 10
Solved Threads: 0
 

Hi,

@waynespangler, your code is working with mouseEnter and MouseLeave, but the OP wants to change the backcolor when Tabstop set the focus on the textbox.

@Gopinathv Welkom to the Forum :icon_smile:

Luc001
Posting Whiz
376 posts since Mar 2010
Reputation Points: 85
Solved Threads: 98
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You