473,782 Members | 2,479 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Button change color when mouseover

HS1
Hello all
Do you know how to change color of a button when the mouse is over it (like
a button in manu bar can change its color in a website) in VB.net
Thank you
S.Hoa
Nov 21 '05 #1
2 13496
Hoa,

Have a look at this sample of my it does two buttons, I mostly use it to
show a control array.

I hope this helps?

Cor
\\\needs two buttons and a label on a form
Private Sub Form1_Load(ByVa l sender As Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Dim btnArea As Button() = New Button() {Button1, Button2}
For Each btn As Button In btnArea
AddHandler btn.MouseLeave, AddressOf Button_MouseLea ve
AddHandler btn.MouseEnter, AddressOf Button_MouseEnt er
Next
End Sub
Private Sub Button_MouseLea ve(ByVal sender As Object, _
ByVal e As System.EventArg s)
DirectCast(send er, Button).BackCol or = Color.Black
Me.Label1.Text = ""
End Sub
Private Sub Button_MouseEnt er(ByVal sender As Object, _
ByVal e As System.EventArg s)
DirectCast(send er, Button).BackCol or = Color.Red
Me.Label1.Text = DirectCast(send er, Button).Name
End Sub
End Class
///
Nov 21 '05 #2
Thanks
That is what I am looking for

"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:eA******** ******@TK2MSFTN GP11.phx.gbl...
Hoa,

Have a look at this sample of my it does two buttons, I mostly use it to
show a control array.

I hope this helps?

Cor
\\\needs two buttons and a label on a form
Private Sub Form1_Load(ByVa l sender As Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Dim btnArea As Button() = New Button() {Button1, Button2}
For Each btn As Button In btnArea
AddHandler btn.MouseLeave, AddressOf Button_MouseLea ve
AddHandler btn.MouseEnter, AddressOf Button_MouseEnt er
Next
End Sub
Private Sub Button_MouseLea ve(ByVal sender As Object, _
ByVal e As System.EventArg s)
DirectCast(send er, Button).BackCol or = Color.Black
Me.Label1.Text = ""
End Sub
Private Sub Button_MouseEnt er(ByVal sender As Object, _
ByVal e As System.EventArg s)
DirectCast(send er, Button).BackCol or = Color.Red
Me.Label1.Text = DirectCast(send er, Button).Name
End Sub
End Class
///

Nov 21 '05 #3

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

Similar topics

2
11268
by: Sugapablo | last post by:
Can anyone help me out with some code to change three table cells (<td>) when one is hovered over? I have a calendar grid where each day is made up of three table cells and I want all three to change color when any of the three are hovered over. I would prefer to do this with pure CSS if possible, but if Javascript is the only way...so be it. --
0
1477
by: Panic Student | last post by:
hi all, i'm having trouble with changing image when mouseover on a particular label. Below is what i attempted to but it didn't seem to work at all. I guess my concept is wrong ): Please enlighten me.... thanks a million~ Dim imgImage As WebControls.Image Dim lblLabel As Label
6
3953
by: sr | last post by:
please help i have problem: I know how to change color row in table when my mouse is over on this row and change color to another color when my mouse is out from this row. but i dont know how to change color when i click on this row and change to third color and ,this color stay when my mouse is out.please help
2
4259
by: fritz21 | last post by:
Hi, if somebody coud help me . It`s a beginner`s question but I`ve tryed to solve it for three days. I have several panels and I need to change their color when the mouse is over them. If someone has any ideas...... Thanks.
1
1237
by: lyealain | last post by:
can u pls give me idea on changing the whole row color to become red when one of the column in that row stated the value "false" instead of true
0
1326
by: Reagan | last post by:
Alright i did search in google but can't seem to find it so here goes. How do i get a button to change from the default color to 00FF00 when rolled over any suggestions would be appreciated thanks.
10
3912
by: The Bicycling Guitarist | last post by:
Hello. I have a navigation bar at the top of all my pages with css-styled buttons that change color when hovered over. I am a little confused on how to disable that for the link that the page is on, for example, the sitemap link in the navigation bar on the sitemap page, the studies link for the navigation bar on the studies page, etc. The css is at http://www.TheBicyclingGuitarist.net/css/style.css The sitemap is at...
3
2719
by: nma | last post by:
Hi How do I make the cell change color to 'black' after I click on it. The cell will remain black color until I click another cell which will also change to black. I can do the mouseover and mouseout correctly only to make it change color to black once I click on it. Could someone help? Thansk nma <td width="<?php echo ($cellwidth); ?>" height="17" bgcolor="#00ff00" onMouseOver="this.style.background ='red'"
1
1697
by: Patrick Shin | last post by:
I'm trying to make a text that keeps on changing color, let say about every 5 seconds. I'm actually new at JavaScript and I can't seem to grasp what needs to be done. The text should keep on changing color without mouseover or any intiating buttons.
0
10313
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10146
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10080
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8968
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2875
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.