5
Answers

Few question in C# GUI ?

Nits

Nits

13y
2.9k
1
Hi everyone as I m in learning process of c# I have few question regarding it?

1) how to display msg label on multiple textbox, label or image when we take mouse pointer there or cursor??

2) how to provide an error provider if any textbox is left empty??

3) how to give timer to messagebox button so it get close after 10sec.??
Answers (5)
0
Vulpes

Vulpes

NA 98.3k 1.5m 13y
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
Nits

Nits

NA 40 50.5k 13y
Thanks a lot sir it really work for me. I have just started practicing .net hope I will learn fast:-)
0
Sam Hobbs

Sam Hobbs

NA 28.7k 1.3m 13y
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
Nits

Nits

NA 40 50.5k 13y
thanks sir I will do my Homework but sir how to give timer to messagebox.show button a timer???
0
Mahesh Chand

Mahesh Chand

2 286.9k 123.7m 13y
You can use Tooltip control to display mouse over tooltips. You can use the ErrorProvider control (search this site) for errors and validations.