Windows Develop Bookmark and Share   
 index > Windows Forms General > How to make a description appear when cursor is over a button?
 

How to make a description appear when cursor is over a button?

how do i make a description appear when cursor is over a button?

for example

i put my cursor over my button and below it comes a description
noobCompSci  Wednesday, December 05, 2007 1:06 AM
Hi,

Sorry, the last post from Chewey was from me, I was in the wrong account.

To get to the events window, make sure you can see the properties window, then click the little lightning looking thing (ensure that your button is selected before you do this).

Then you can see all the events that a button can do. Double click on one to add an event (i did this for the MouseEnter and Leave ones).

My code may not work because your button or label are not named the same.

J


Jordan Knight  Wednesday, December 05, 2007 1:51 AM
Hi

I assume you mean in windows forms?

Add a button and a label below it, then put in events for MouseEnter nad MouseLeave for the button like below.

private void button1_MouseEnter(object sender, EventArgs e)

{

label1.Text = "Mouse over button1";

}

private void button1_MouseLeave(object sender, EventArgs e)

{

label1.Text = string.Empty;

}

I used the events properties window to add these two events (i.e. I didn't type them manually - the only part i did was the label1.Text lines).

J

P.S. if you are referring to ASP.NET then let us know.
Chewwy  Wednesday, December 05, 2007 1:34 AM
like my name says im a beginner programmer

how do i access the events property window??
and i tried your code out and it didnt work

private void button1_MouseEnter(object sender, EventArgs e)
{

label2.Text = "Tutorial";
}
private void button1_MouseLeave(object sender, EventArgs e)
{

label2.Text = "";

}
private void button1_Click_1(object sender, EventArgs e)
{
Form tutorial = new Form4();
tutorial.Show();
}

dont wrry about wat the button1_Click event does
but thats the code
noobCompSci  Wednesday, December 05, 2007 1:44 AM
Hi,

Sorry, the last post from Chewey was from me, I was in the wrong account.

To get to the events window, make sure you can see the properties window, then click the little lightning looking thing (ensure that your button is selected before you do this).

Then you can see all the events that a button can do. Double click on one to add an event (i did this for the MouseEnter and Leave ones).

My code may not work because your button or label are not named the same.

J


Jordan Knight  Wednesday, December 05, 2007 1:51 AM
Thank you so much not only did you help me now
but you tought me something for the future thnxSmile
noobCompSci  Wednesday, December 05, 2007 1:58 AM
Hello,
you can use tooltip for that.
no need for event handler.
Tool tip is control .you will get it in tool box. Add it to your win form.
Then, in the button control you will have a tooltip property , just write discription .

Cheers
Watashi_me  Wednesday, December 05, 2007 2:09 AM
ok thnx
noobCompSci  Sunday, December 09, 2007 5:20 PM

You can use google to search for other answers

Custom Search

More Threads

• Text Form Fields to autopopulate
• TextBox, KeyPress event, F2 Key
• reorder listview based on Tag
• Compare two datasources
• listview searching in coulumn
• Changing the color of certain words in a richTextBox C#
• How to use Clipboard ?
• fscommand problem with flash player
• Application.DoEvents() in multiple threads
• Problem with display parent & child nodes if XML not follows an Hierarchical structure