MessageBox with a timer?
-
How would I add a timer to this? To keep things simple, I have a form with 1 button and 1 textbox. I have a messagebox that pops up when the textbox loses focus ... if the user clicks OK, it does something. However, if the user doesn't click OK within 3 seconds, I need the box to close and do something else. This is for a mobile app using .NETCF 3.5. Here's what I have so far in regards to the messagebox:
private void TextBox1_LostFocus(object sender, EventArgs e) { DialogResult result = MessageBox.show("message text","title",MessageBoxButtons.OK,MessageBoxIcon.None,MessageBoxDefaultButton.Button1): if (result == DialogResult.OK) { Button1.Focus(); } else { //Close messagebox and do some other things if 3 seconds have elapsed and OK was not clicked } }
Any help would be appreciated! Thanks! -
How would I add a timer to this? To keep things simple, I have a form with 1 button and 1 textbox. I have a messagebox that pops up when the textbox loses focus ... if the user clicks OK, it does something. However, if the user doesn't click OK within 3 seconds, I need the box to close and do something else. This is for a mobile app using .NETCF 3.5. Here's what I have so far in regards to the messagebox:
private void TextBox1_LostFocus(object sender, EventArgs e) { DialogResult result = MessageBox.show("message text","title",MessageBoxButtons.OK,MessageBoxIcon.None,MessageBoxDefaultButton.Button1): if (result == DialogResult.OK) { Button1.Focus(); } else { //Close messagebox and do some other things if 3 seconds have elapsed and OK was not clicked } }
Any help would be appreciated! Thanks!Most likely you'll need to create a Form that looks like a message box that has a timer on it. The built-in MessageBox is not very customizable outside of the text and icons.
-
How would I add a timer to this? To keep things simple, I have a form with 1 button and 1 textbox. I have a messagebox that pops up when the textbox loses focus ... if the user clicks OK, it does something. However, if the user doesn't click OK within 3 seconds, I need the box to close and do something else. This is for a mobile app using .NETCF 3.5. Here's what I have so far in regards to the messagebox:
private void TextBox1_LostFocus(object sender, EventArgs e) { DialogResult result = MessageBox.show("message text","title",MessageBoxButtons.OK,MessageBoxIcon.None,MessageBoxDefaultButton.Button1): if (result == DialogResult.OK) { Button1.Focus(); } else { //Close messagebox and do some other things if 3 seconds have elapsed and OK was not clicked } }
Any help would be appreciated! Thanks!Hi, this has been handled before: http://www.codeproject.com/info/search.aspx?artkw=messagebox+timer&sbo=kw[^] :)
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.
-
Hi, this has been handled before: http://www.codeproject.com/info/search.aspx?artkw=messagebox+timer&sbo=kw[^] :)
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.
I did search a bit first, but the first few answers were in VB or C++. I was hoping for C# examples. I did look further on the results and came across http://www.codeproject.com/KB/cs/A_Custom_Message_Box.aspx[^] which might be helpful. Thanks!
-
Most likely you'll need to create a Form that looks like a message box that has a timer on it. The built-in MessageBox is not very customizable outside of the text and icons.
-
I did search a bit first, but the first few answers were in VB or C++. I was hoping for C# examples. I did look further on the results and came across http://www.codeproject.com/KB/cs/A_Custom_Message_Box.aspx[^] which might be helpful. Thanks!
Hi, why is language that important? to learn concepts just read the text and look at the program structure and the classes/methods used. if you can write C# I trust you can also read VB code? :)
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.
-
Hi, why is language that important? to learn concepts just read the text and look at the program structure and the classes/methods used. if you can write C# I trust you can also read VB code? :)
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.