TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Alex
NA
5
0
Problem displaying a messageBox
Aug 2 2007 11:32 AM
Hi,
I'm working on a WinForm application with .NET CF 2.0 and I have a background running thread that needs to notify the user about various events. The problem is that everytime I want to notify the user with a MessageBox about an event, the application exits once the messagebox is displayed...I get the following message in the output window: The thread 0x2eda2a2 has exited with code 0 (0x0).
However, if I display the message in a label of my form, everything works well...here is the code I use:
public void DisplayMessage(string message)
{
if (InvokeRequired)
{
DisplayMessageDelegate displayMessageDelegate = new DisplayMessageDelegate(DisplayMessage);
this.Invoke(displayMessageDelegate, new object[] { message });
}
else
{
this.labelStatus.Text = message; // Works well
MessageBox.Show(message, "Info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); // Application exits when called
}
}
Thanks in advance!
alex
Reply
Answers (
4
)
Exercises in C#
Using WebDav to delete mail from a MS exchange account