i want to display mouse leave event on textbox?(windows applications)

Posted by Sudheep.grandhe under C# on 11/25/2011 | Points: 10 | Views : 7527 | Status : [Member] | Replies : 3
Hi,

if the user without entering the details if the cursor moves to the next textbox.it should display a message like please enter the details .textbox is empty.it should display on textbox when ever the textfield leaves as empty only otherwise no need to display the message.

Best,
Sudheep.



Responses

Posted by: Rajeev.Shukla on: 11/25/2011 [Member] Starter | Points: 25

Up
0
Down
Write following codes on TextBox Leave Event as below-

private void textBox1_Leave(object sender, EventArgs e)
{
if (textBox1.Text == string.Empty)
{
MessageBox.Show("The value can not be blank.");
}
}



Sudheep.grandhe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sksingh on: 11/25/2011 [Member] Starter | Points: 25

Up
0
Down
You can use Validating or Validated event of TextBox to handle any validation related stuffs.

Regards,
Sunil

Sudheep.grandhe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Arefin on: 11/29/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,

Rajeev's answer is okay. Just try it.

Thanks,
Arefin

Sudheep.grandhe, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response