|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Changing Color of TextBox on Hover - With Correct Examples!!!textbox when the user hovers over it. In a Module I have the following routines: Public Sub Button_Hover(ByRef btnName As Button) btnName.BackColor = Color.BlanchedAlmond End Sub Public Sub Button_Leave(ByRef btnName As Button) btnName.BackColor = Color.Transparent End Sub ---------------------------------------------- I called the routines from the following code: Private Sub cmdTierCancel_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdTierCancel.MouseHover Button_Hover(cmdTierCancel) End Sub Private Sub cmdTierCancel_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdTierCancel.MouseLeave Button_Leave(cmdTierCancel) End Sub --------------------------------- SO FAR SO GOOD. I thought it would be nice to use the Handles feature and call the routine like this: --------------------------------- Public Sub Handles_All_Buttons(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmd1.MouseHover, cmd2.MouseHover, cmd3.MouseHover Button_Hover(sender) End Sub But this routine doesn't work. Can anyone tell me what I am doing wrong? Thanks Check out my response (the one with the code)
to your other posting. I think if you want to add events, you need to treat the Button_Hover and Button_Leave routines as events, with the appropriate arguments. There's an example in my response to your other thread. Robin S. ------------------------------------- Show quoteHide quote "Henry Jones" <he***@yada.com> wrote in message news:ebIXUWXFHHA.4712@TK2MSFTNGP04.phx.gbl... >I have a VS 2005 VB.NET project and would like to change the color of the > textbox when the user hovers over it. In a Module I have the following > routines: > > Public Sub Button_Hover(ByRef btnName As Button) > > btnName.BackColor = Color.BlanchedAlmond > > End Sub > > Public Sub Button_Leave(ByRef btnName As Button) > > btnName.BackColor = Color.Transparent > > End Sub > > ---------------------------------------------- > > > > I called the routines from the following code: > > > > Private Sub cmdTierCancel_MouseHover(ByVal sender As Object, ByVal e As > System.EventArgs) Handles cmdTierCancel.MouseHover > > Button_Hover(cmdTierCancel) > > End Sub > > Private Sub cmdTierCancel_MouseLeave(ByVal sender As Object, ByVal e As > System.EventArgs) Handles cmdTierCancel.MouseLeave > > Button_Leave(cmdTierCancel) > > End Sub > > --------------------------------- > > SO FAR SO GOOD. I thought it would be nice to use the Handles feature and > call the routine like this: > > --------------------------------- > > Public Sub Handles_All_Buttons(ByVal sender As Object, ByVal e As > System.EventArgs) Handles cmd1.MouseHover, cmd2.MouseHover, > cmd3.MouseHover > > Button_Hover(sender) > > End Sub > > > > But this routine doesn't work. Can anyone tell me what I am doing wrong? > > > > Thanks > > > > > > > > > Sorry, I meant you need to treat them as Event Handlers.
Robin S. --------------------------------- Show quoteHide quote "RobinS" <RobinS@NoSpam.yah.none> wrote in message news:I8-dnRjxSsfO6O3YnZ2dnUVZ_qWdnZ2d@comcast.com... > Check out my response (the one with the code) > to your other posting. I think if you want to > add events, you need to treat the Button_Hover > and Button_Leave routines as events, with > the appropriate arguments. There's an example > in my response to your other thread. > > Robin S. > ------------------------------------- > "Henry Jones" <he***@yada.com> wrote in message > news:ebIXUWXFHHA.4712@TK2MSFTNGP04.phx.gbl... >>I have a VS 2005 VB.NET project and would like to change the color of the >> textbox when the user hovers over it. In a Module I have the following >> routines: >> >> Public Sub Button_Hover(ByRef btnName As Button) >> >> btnName.BackColor = Color.BlanchedAlmond >> >> End Sub >> >> Public Sub Button_Leave(ByRef btnName As Button) >> >> btnName.BackColor = Color.Transparent >> >> End Sub >> >> ---------------------------------------------- >> >> >> >> I called the routines from the following code: >> >> >> >> Private Sub cmdTierCancel_MouseHover(ByVal sender As Object, ByVal e As >> System.EventArgs) Handles cmdTierCancel.MouseHover >> >> Button_Hover(cmdTierCancel) >> >> End Sub >> >> Private Sub cmdTierCancel_MouseLeave(ByVal sender As Object, ByVal e As >> System.EventArgs) Handles cmdTierCancel.MouseLeave >> >> Button_Leave(cmdTierCancel) >> >> End Sub >> >> --------------------------------- >> >> SO FAR SO GOOD. I thought it would be nice to use the Handles feature >> and >> call the routine like this: >> >> --------------------------------- >> >> Public Sub Handles_All_Buttons(ByVal sender As Object, ByVal e As >> System.EventArgs) Handles cmd1.MouseHover, cmd2.MouseHover, >> cmd3.MouseHover >> >> Button_Hover(sender) >> >> End Sub >> >> >> >> But this routine doesn't work. Can anyone tell me what I am doing wrong? >> >> >> >> Thanks >> >> >> >> >> >> >> >> >> > >
Changing Color of Textbox on Hover
Offline application for reporting and collect data Best Approach When Saving a New Project Report Viewer Asynchronous thread abort error Fastest String search No Response Redirect but something like Response Forward? Disable sort on specific columns with VB.NET datagrid SyncLock Required? Error in displaying data grid What does this mean? |
|||||||||||||||||||||||