473,406 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Changing Color of Textbox on Hover

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 Handles(ByVal sender As Object, ByVal e As
System.EventArgs) cmd1.MouseHover, cmd2.MouseHover, cmd3.MouseHover

Button_Leave(sender)

End Sub

But this routine doesn't work. Can anyone tell me what I am doing wrong?

Thanks


Dec 1 '06 #1
12 3144
In the last routine, Button_Leave should be Button_Hover
"Henry Jones" <he***@yada.comwrote in message
news:eb**************@TK2MSFTNGP02.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 Handles(ByVal sender As Object, ByVal e As
System.EventArgs) cmd1.MouseHover, cmd2.MouseHover, cmd3.MouseHover

Button_Leave(sender)

End Sub

But this routine doesn't work. Can anyone tell me what I am doing wrong?

Thanks




Dec 1 '06 #2
Did you intend to call Button_Hover from your final Handles-enabled routine,
or was that just a typo?

-----
Tim Patrick - www.timaki.com
Start-to-Finish Visual Basic 2005
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 Handles(ByVal sender As Object, ByVal e
As System.EventArgs) cmd1.MouseHover, cmd2.MouseHover,
cmd3.MouseHover

Button_Leave(sender)

End Sub

But this routine doesn't work. Can anyone tell me what I am doing
wrong?

Thanks

Dec 1 '06 #3
Henry,

I am interested. What makes it that you think nicer to use handles instead
of .Net methods?

Cor

You want to show that you are a starting programmer or something like that?
"Henry Jones" <he***@yada.comschreef in bericht
news:eb**************@TK2MSFTNGP02.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 Handles(ByVal sender As Object, ByVal e As
System.EventArgs) cmd1.MouseHover, cmd2.MouseHover, cmd3.MouseHover

Button_Leave(sender)

End Sub

But this routine doesn't work. Can anyone tell me what I am doing wrong?

Thanks




Dec 1 '06 #4
I thought it be cleaner to use one routine that handles many buttons than to
create more code. Better for maintenance later on. Am I wrong?
But that isn't the point. I would like to know how to do it, now that I
have thought of it. I don't know if it's good programming practice, but
that is what these forums are all about.

Thanks,

Henry

"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Henry,

I am interested. What makes it that you think nicer to use handles instead
of .Net methods?

Cor

You want to show that you are a starting programmer or something like
that?
"Henry Jones" <he***@yada.comschreef in bericht
news:eb**************@TK2MSFTNGP02.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 Handles(ByVal sender As Object, ByVal e As
System.EventArgs) cmd1.MouseHover, cmd2.MouseHover, cmd3.MouseHover

Button_Leave(sender)

End Sub

But this routine doesn't work. Can anyone tell me what I am doing wrong?

Thanks





Dec 1 '06 #5
In the last routine, shouldn't the Handles keyword come
after the "(ByVal sender as Object, e as EventArgs)"
and before cmd1.MouseHover, etc.?

Robin S.
------------------------------------------
"Henry Jones" <he***@yada.comwrote in message
news:OT*************@TK2MSFTNGP02.phx.gbl...
In the last routine, Button_Leave should be Button_Hover
"Henry Jones" <he***@yada.comwrote in message
news:eb**************@TK2MSFTNGP02.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 Handles(ByVal sender As Object, ByVal e As
System.EventArgs) cmd1.MouseHover, cmd2.MouseHover, cmd3.MouseHover

Button_Leave(sender)

End Sub

But this routine doesn't work. Can anyone tell me what I am doing wrong?

Thanks





Dec 1 '06 #6
Yes, that was another "cut and paste" typo. In my code, it is correct.
Oops.

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:bc******************************@comcast.com. ..
In the last routine, shouldn't the Handles keyword come
after the "(ByVal sender as Object, e as EventArgs)"
and before cmd1.MouseHover, etc.?

Robin S.
------------------------------------------
"Henry Jones" <he***@yada.comwrote in message
news:OT*************@TK2MSFTNGP02.phx.gbl...
>In the last routine, Button_Leave should be Button_Hover
"Henry Jones" <he***@yada.comwrote in message
news:eb**************@TK2MSFTNGP02.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 Handles(ByVal sender As Object, ByVal e
As System.EventArgs) cmd1.MouseHover, cmd2.MouseHover, cmd3.MouseHover

Button_Leave(sender)

End Sub

But this routine doesn't work. Can anyone tell me what I am doing
wrong?

Thanks






Dec 1 '06 #7
Henry,

I have a routine in my base form that adds event handlers for
mouseenter and mouseleave to textboxes. This changes the backcolor
when the user enters the textbox, and changes it back when he leaves.
I learned this from Deborah Kurata book, Doing Objects in VB2005
(just to give credit where credit is due).

To do this, I cycle through the controls on my forms and
use AddHandler to add the event handlers to each control.

If I add new controls of that type to the form,
they are automatically handled.

If I remove controls from the form, that is automatically
handled; I don't need to remove them from any Handles clauses.

Also, all controls of the same type are handled the same way.

I actually have this code in a base form, and all of my forms
inherit from it. That way, I have the same behavior on every
form in my application. (As one of my old teachers used to say,
"Right or wrong, be consistent.")

Here's the code. This is recursive to handle the cases where you
have controls within controls, like textboxes within panels. I
didn't try this out, but it's almost identical to my code that
does the textboxes.

In Form_Load, add this: AddEventHandlers(me)

Private Sub AddEventHandlers(ByVal ctrlContainer As Control)
For Each ctrl As Control In ctrlContainer.Controls
If TypeOf ctrl Is Button Then
'When the MouseHover event is raised for this button,
' run the Button_Hover routine.
AddHandler ctrl.MouseHover, AddressOf Button_Hover
'When the MouseLeave event is raised for this button,
' run the Button_Leave routine.
AddHandler ctrl.MouseLeave, AddressOf Button_Leave
End If
'if control has children, call this function recursively
If ctrl.HasChildren Then
AddEventHandlers(ctrl)
End If
Next
End Sub

Public Sub Button_Hover(ByVal sender as Object, _
ByVal e as System.EventArgs)
DirectCast(sender, Control).BackColor = _
Color.BlanchedAlmond
End Sub

Public Sub Button_Leave(ByVal sender as Object, _
ByVal e as System.EventArgs)
DirectCast(sender, Control).BackColor = _
Color.Transparent
'Note: you can also change this to one of
' the known colors, like the color of
' the buttonface:
'DirectCast(sender, Control).BackColor = _
' Color.FromKnownColor(KnownColor.ButtonFace)
End Sub

What do you think?
Robin S.
------------------------------------------

"Henry Jones" <he***@yada.comwrote in message
news:O7**************@TK2MSFTNGP02.phx.gbl...
>I thought it be cleaner to use one routine that handles many buttons than
to create more code. Better for maintenance later on. Am I wrong?
But that isn't the point. I would like to know how to do it, now that I
have thought of it. I don't know if it's good programming practice, but
that is what these forums are all about.

Thanks,

Henry

"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>Henry,

I am interested. What makes it that you think nicer to use handles
instead of .Net methods?

Cor

You want to show that you are a starting programmer or something like
that?
"Henry Jones" <he***@yada.comschreef in bericht
news:eb**************@TK2MSFTNGP02.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 Handles(ByVal sender As Object, ByVal e
As System.EventArgs) cmd1.MouseHover, cmd2.MouseHover, cmd3.MouseHover

Button_Leave(sender)

End Sub

But this routine doesn't work. Can anyone tell me what I am doing
wrong?

Thanks






Dec 1 '06 #8
Hi RobinS,

The code works like a charm. Very cool. If you were here in Sunny Los
Angeles, (maybe you are....dunno) I'd buy you Starbucks Coffee.

Thanks,

Henry
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:Ka******************************@comcast.com. ..
Henry,

I have a routine in my base form that adds event handlers for
mouseenter and mouseleave to textboxes. This changes the backcolor
when the user enters the textbox, and changes it back when he leaves.
I learned this from Deborah Kurata book, Doing Objects in VB2005
(just to give credit where credit is due).

To do this, I cycle through the controls on my forms and
use AddHandler to add the event handlers to each control.

If I add new controls of that type to the form,
they are automatically handled.

If I remove controls from the form, that is automatically
handled; I don't need to remove them from any Handles clauses.

Also, all controls of the same type are handled the same way.

I actually have this code in a base form, and all of my forms
inherit from it. That way, I have the same behavior on every
form in my application. (As one of my old teachers used to say,
"Right or wrong, be consistent.")

Here's the code. This is recursive to handle the cases where you
have controls within controls, like textboxes within panels. I
didn't try this out, but it's almost identical to my code that
does the textboxes.

In Form_Load, add this: AddEventHandlers(me)

Private Sub AddEventHandlers(ByVal ctrlContainer As Control)
For Each ctrl As Control In ctrlContainer.Controls
If TypeOf ctrl Is Button Then
'When the MouseHover event is raised for this button,
' run the Button_Hover routine.
AddHandler ctrl.MouseHover, AddressOf Button_Hover
'When the MouseLeave event is raised for this button,
' run the Button_Leave routine.
AddHandler ctrl.MouseLeave, AddressOf Button_Leave
End If
'if control has children, call this function recursively
If ctrl.HasChildren Then
AddEventHandlers(ctrl)
End If
Next
End Sub

Public Sub Button_Hover(ByVal sender as Object, _
ByVal e as System.EventArgs)
DirectCast(sender, Control).BackColor = _
Color.BlanchedAlmond
End Sub

Public Sub Button_Leave(ByVal sender as Object, _
ByVal e as System.EventArgs)
DirectCast(sender, Control).BackColor = _
Color.Transparent
'Note: you can also change this to one of
' the known colors, like the color of
' the buttonface:
'DirectCast(sender, Control).BackColor = _
' Color.FromKnownColor(KnownColor.ButtonFace)
End Sub

What do you think?
Robin S.
------------------------------------------

"Henry Jones" <he***@yada.comwrote in message
news:O7**************@TK2MSFTNGP02.phx.gbl...
>>I thought it be cleaner to use one routine that handles many buttons than
to create more code. Better for maintenance later on. Am I wrong?
But that isn't the point. I would like to know how to do it, now that I
have thought of it. I don't know if it's good programming practice, but
that is what these forums are all about.

Thanks,

Henry

"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>>Henry,

I am interested. What makes it that you think nicer to use handles
instead of .Net methods?

Cor

You want to show that you are a starting programmer or something like
that?
"Henry Jones" <he***@yada.comschreef in bericht
news:eb**************@TK2MSFTNGP02.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 Handles(ByVal sender As Object, ByVal e
As System.EventArgs) cmd1.MouseHover, cmd2.MouseHover, cmd3.MouseHover

Button_Leave(sender)

End Sub

But this routine doesn't work. Can anyone tell me what I am doing
wrong?

Thanks






Dec 1 '06 #9
Good! I'm glad. I'm in the SF Bay Area, so it's a bit far
to drive for coffee!

Robin S.
-----------------------
"Henry Jones" <he***@yada.comwrote in message
news:%2***************@TK2MSFTNGP05.phx.gbl...
Hi RobinS,

The code works like a charm. Very cool. If you were here in Sunny Los
Angeles, (maybe you are....dunno) I'd buy you Starbucks Coffee.

Thanks,

Henry
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:Ka******************************@comcast.com. ..
>Henry,

I have a routine in my base form that adds event handlers for
mouseenter and mouseleave to textboxes. This changes the backcolor
when the user enters the textbox, and changes it back when he leaves.
I learned this from Deborah Kurata book, Doing Objects in VB2005
(just to give credit where credit is due).

To do this, I cycle through the controls on my forms and
use AddHandler to add the event handlers to each control.

If I add new controls of that type to the form,
they are automatically handled.

If I remove controls from the form, that is automatically
handled; I don't need to remove them from any Handles clauses.

Also, all controls of the same type are handled the same way.

I actually have this code in a base form, and all of my forms
inherit from it. That way, I have the same behavior on every
form in my application. (As one of my old teachers used to say,
"Right or wrong, be consistent.")

Here's the code. This is recursive to handle the cases where you
have controls within controls, like textboxes within panels. I
didn't try this out, but it's almost identical to my code that
does the textboxes.

In Form_Load, add this: AddEventHandlers(me)

Private Sub AddEventHandlers(ByVal ctrlContainer As Control)
For Each ctrl As Control In ctrlContainer.Controls
If TypeOf ctrl Is Button Then
'When the MouseHover event is raised for this button,
' run the Button_Hover routine.
AddHandler ctrl.MouseHover, AddressOf Button_Hover
'When the MouseLeave event is raised for this button,
' run the Button_Leave routine.
AddHandler ctrl.MouseLeave, AddressOf Button_Leave
End If
'if control has children, call this function recursively
If ctrl.HasChildren Then
AddEventHandlers(ctrl)
End If
Next
End Sub

Public Sub Button_Hover(ByVal sender as Object, _
ByVal e as System.EventArgs)
DirectCast(sender, Control).BackColor = _
Color.BlanchedAlmond
End Sub

Public Sub Button_Leave(ByVal sender as Object, _
ByVal e as System.EventArgs)
DirectCast(sender, Control).BackColor = _
Color.Transparent
'Note: you can also change this to one of
' the known colors, like the color of
' the buttonface:
'DirectCast(sender, Control).BackColor = _
' Color.FromKnownColor(KnownColor.ButtonFace)
End Sub

What do you think?
Robin S.
------------------------------------------

"Henry Jones" <he***@yada.comwrote in message
news:O7**************@TK2MSFTNGP02.phx.gbl...
>>>I thought it be cleaner to use one routine that handles many buttons than
to create more code. Better for maintenance later on. Am I wrong?
But that isn't the point. I would like to know how to do it, now that I
have thought of it. I don't know if it's good programming practice, but
that is what these forums are all about.

Thanks,

Henry

"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl.. .
Henry,

I am interested. What makes it that you think nicer to use handles
instead of .Net methods?

Cor

You want to show that you are a starting programmer or something like
that?
"Henry Jones" <he***@yada.comschreef in bericht
news:eb**************@TK2MSFTNGP02.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 Handles(ByVal sender As Object, ByVal e
As System.EventArgs) cmd1.MouseHover, cmd2.MouseHover,
cmd3.MouseHover
>
Button_Leave(sender)
>
End Sub
>
>
>
But this routine doesn't work. Can anyone tell me what I am doing
wrong?
>
>
>
Thanks
>
>
>
>
>
>
>
>




Dec 1 '06 #10
"Henry Jones" <he***@yada.comschrieb:
Public Sub Button_Hover(ByRef btnName As Button)
[...]
Public Sub Button_Leave(ByRef btnName As Button)
'ByRef' ='ByVal'.
>
btnName.BackColor = Color.Transparent

End Sub
[...]
Public Sub Handles_All_Buttons Handles(ByVal sender As Object, ByVal e As
System.EventArgs) cmd1.MouseHover, cmd2.MouseHover, cmd3.MouseHover

Button_Leave(sender)

But this routine doesn't work. Can anyone tell me what I am doing wrong?
'Button_Leave(DirectCast(sender, Button))'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Dec 1 '06 #11
"Cor Ligthert [MVP]" <no************@planet.nlschrieb:
I am interested. What makes it that you think nicer to use handles instead
of .Net methods?
I feel sorry, but I do not understand what you are meaning...

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Dec 1 '06 #12
Have a look what Robin wrote, than you understand it.
There is nothing more for me to add.

Cor

"Herfried K. Wagner [MVP]" <hi***************@gmx.atschreef in bericht
news:%2*****************@TK2MSFTNGP02.phx.gbl...
"Cor Ligthert [MVP]" <no************@planet.nlschrieb:
>I am interested. What makes it that you think nicer to use handles
instead of .Net methods?

I feel sorry, but I do not understand what you are meaning...

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Dec 1 '06 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Don G | last post by:
Within the menu for my site, I have inserted 'class="current"' within the link for the current page. So the link looks somthing link: <li><a href="index.php" class="current">Home</a></li> The...
4
by: Hello | last post by:
Hello, I am trying to have an image in a link to show border and change color from black to reddish when user hovers over with a cursor. In IE6 it works as I would like it to, but in Firefox1...
7
by: squidco | last post by:
I have some paragraphs on a page that I'd like have change color when the mouse is hovering over them. This declaration works great in Firefox and Safari, but doesn't do anything in IE. ...
2
by: Marita | last post by:
I know that you can change the cell background color on mouseover, but is there a way with stylesheets that a background image can be swapped? Thanks in advance for any advice! Marita
25
by: madsgormlarsen | last post by:
Hi I am making a tab menu with css, and the tabs changes color depending on wich tab is current. 1. I could load a different css file for each tab/color. 2. I could do some inline css only...
2
by: Dave | last post by:
Is there a way to enlarge the text cursor? We need to make it a bit wider to improve visibility and we cannot find any information about this. Many, MANY thanks in advance!
12
by: Nico Schuyt | last post by:
Maybe a stupid question (I'm not so familiar with javascript), but: I want to change background of a paragraph or list item on mouseover. The following code works: <p...
15
by: phillip.s.powell | last post by:
<style> div div table tr td a.navbar, div div table tr td font {display: none;} </style> <div class="navigationbar" style="background-color:Black; position: absolute; left:50%; top:127px;...
5
by: kimiraikkonen | last post by:
Hi, I couldn't find a necessary class which shows when mouse hovers on a link in Webbrowser control. Think of there's a status bar(text), when mouse comes on a link, the URL must be shown in...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.