0
Here's an easy way to automatically close a MessageBox after 10 seconds.
Suppose, the timer is started and the MessageBox is opened on a button click:
private void button1_Click(object sender, EventArgs e)
{
timer1.Interval = 10000;
timer1.Start();
MessageBox.Show("Some message");
}
then place this code in the timer's Tick eventhandler:
private void timer1_Tick(object sender, EventArgs e)
{
SendKeys.SendWait("%{F4}"); // closes the MessageBox
timer1.Stop();
}
This code uses the keyboard shortcut Alt+F4 to close the active window.
Accepted 0
Thanks a lot sir it really work for me. I have just started practicing .net hope I will learn fast:-)
0
It helps to put separate questions in separate threads. You are more likely to get all questions answered that way.
Message boxes were not designed to be timed. It will be easy to just create a form that works like a message box except different in whatever ways you need it to be different.
0
thanks sir I will do my Homework but sir how to give timer to messagebox.show button a timer???
0
You can use Tooltip control to display mouse over tooltips. You can use the ErrorProvider control (search this site) for errors and validations.