i want to change the status bar's text, when the mouse comes over the button..
and i use MouseEnter event for this..and my code is like this..
private void button1_Click(object sender, EventArgs e)
{
this.MouseEnter+=new EventHandler(Form3_MouseEnter);
}
void Form3_MouseEnter(object sender, EventArgs e)
{
toolStripStatusLabel1.Text = "Hello";
}
what is wrong with this code

MouseEnter Event
JJ_on_MSN
junior.skunk
// add this code to the FormX.designer
this.button1.MouseEnter += new System.Windows.Forms.MouseEventHandler(this.button1_MouseEnter);
spasnikowski
Hi,
for the sake of other people having the same problems here is the solution:
What happens in teh code above is that the MouseEnter event is being handled in the Form instead of the button. Also the handling happens when the user presses the button, which means that if the user doen't presses the button the MouseEnter event wouldn't be handled.
The proper way of handling a buttons mouse enter event is by selecting the control in the designer and go to properties and click the lightning button (which stands for events) select the MouseEnter event and double click the empty space beside it. It would auto generated an event to be handled by your button. It looks like this:
void button1_MouseEnter(object sender, EventArgs e)
{
toolStripStatusLabel1.Text = "Hello";
}
cheers,
Paul June A. Domag