prevent MessageBox from continuously reappearing
-
hi guys, how can i prevent a messagebox from reappearing? i have this timer that if the client is not connected to the server, a messagebox would appear informing the user that he is not connected to the server. i want the messagebox to show only once, until he is connected to the server. tnx in advance..:)
-
hi guys, how can i prevent a messagebox from reappearing? i have this timer that if the client is not connected to the server, a messagebox would appear informing the user that he is not connected to the server. i want the messagebox to show only once, until he is connected to the server. tnx in advance..:)
-
How long a message box is displayed is controlled by the user. If you want to remove the messagebox by code, you can't use a messagebox. Use a small form instead. --- b { font-weight: normal; } -- modified at 8:25 Monday 27th February, 2006
thanks for the reply..:) ok, i thnk ill use a form as you suggested. how can automatically close the form? will i use a timer?
-
hi guys, how can i prevent a messagebox from reappearing? i have this timer that if the client is not connected to the server, a messagebox would appear informing the user that he is not connected to the server. i want the messagebox to show only once, until he is connected to the server. tnx in advance..:)
-
Couldnt you just use a bool value to indicate whether or not its shown (might have to create it as an object for this) and use an if statement to act accordingly ?
uhhh how is dat possible autekre?:) is that for the messagebox or the form?
-
hi guys, how can i prevent a messagebox from reappearing? i have this timer that if the client is not connected to the server, a messagebox would appear informing the user that he is not connected to the server. i want the messagebox to show only once, until he is connected to the server. tnx in advance..:)
public partial class Form1 : Form { private Boolean lShowedOnce = false; public Form1() { InitializeComponent(); } private void Timer1_Tick(object Sender, EventArgs e) { if (this.Tag != "Connected") { if (!lShowedOnce) { lShowedOnce = true; MessageBox.Show("You are not connected to the server...."); } if (ConnectToServer()) this.Tag = "Connected"; } } private Boolean ConnectToServer() { Boolean lConnected = false; //Attempt to connect to the server right here return (lConnected); } }
---------- There go my people. I must find out where they are going so I can lead them. - Alexander Ledru-Rollin -
public partial class Form1 : Form { private Boolean lShowedOnce = false; public Form1() { InitializeComponent(); } private void Timer1_Tick(object Sender, EventArgs e) { if (this.Tag != "Connected") { if (!lShowedOnce) { lShowedOnce = true; MessageBox.Show("You are not connected to the server...."); } if (ConnectToServer()) this.Tag = "Connected"; } } private Boolean ConnectToServer() { Boolean lConnected = false; //Attempt to connect to the server right here return (lConnected); } }
---------- There go my people. I must find out where they are going so I can lead them. - Alexander Ledru-Rollinhey thanks man!:D i'll try this code immediately..:D i really appreciate it..:D