473,395 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Problem displaying a messageBox in .NET CF

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:

Expand|Select|Wrap|Line Numbers
  1. public void DisplayMessage(string message)
  2.         {
  3.             if (InvokeRequired)
  4.             {
  5.                 DisplayMessageDelegate displayMessageDelegate = new DisplayMessageDelegate(DisplayMessage);
  6.                 this.Invoke(displayMessageDelegate, new object[] { message });
  7.             }
  8.             else
  9.             {
  10.                 this.labelStatus.Text = message;  // Works well
  11.                 MessageBox.Show(message, "Info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); // Application exits when called
  12.  
  13.             }
  14.         }
Thanks in advance!
alex
Aug 2 '07 #1
2 1750
Plater
7,872 Expert 4TB
What's wrong with just using System.Windows.Forms.MessageBox.Show()?
I use CF2.0 as well and have not run into the those issues. I also never did any of that invoke stuff.
If your errorhandling set to do anything after it pops up that messagebox?

What language are you using?
Aug 2 '07 #2
I'm using C#...

My method DisplayMessage(string) used to be only { MessageBox.Show(message) }, but I've added the Invoke section when I've started to display the message on the label of my form (which works well...). Since the DisplayMessage method is called from my 2nd thread, I need to use Invoke() to update the label, which is on my Form thread, or the app crashes.

I know that I don't need the Invoke() to display the messagebox, but I have the same problem if I remove it.

Thanks!


What's wrong with just using System.Windows.Forms.MessageBox.Show()?
I use CF2.0 as well and have not run into the those issues. I also never did any of that invoke stuff.
If your errorhandling set to do anything after it pops up that messagebox?

What language are you using?
Aug 2 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Bil Muh | last post by:
Esteemede Developers, I would like to Thank All of You in advance for your sincere guidances. I am developing a software using Visual C++ .NET Standard Edition with Windows Form (.NET)...
11
by: Rich Tasker | last post by:
I have a strange situation. A simple call to MessageBox.Show("XXX", "YYY") does not display the message in the messagebox with a visible font. Based on the content of the messagebox, the box...
6
by: Omar | last post by:
When I try to databind my comboBox (specifically field "emplcode") to a filled dataset , the contents of the comboBox displays a bunch of "System.Data.DataRowView". I assume the amount of times...
3
by: Cybertof | last post by:
Hello, I have a strange behavior. On a MyForm form, i have a button with this code ----> MessageBox.Show("hello"); When i start the project with this single form ----> Application.Run(new...
5
by: Jim Heimer | last post by:
When I use the dataview.rowfilter and I try to display the field value of the first row, the code doesn't seem to show the first row AFTER the rowfilter. This is my code: DataView...
20
by: Peter E. Granger | last post by:
I'm having a strange problem (or at least it seems strange to me) trying to display a MessageBox in a VC++ .NET forms application. If I put the call to MessageBox::Show in the form's .h file, it...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
4
by: Jaya | last post by:
I have a program which runs in multiple languages. The problem is that message boxes displayed when I run my program on Hebrew still have left-to-right reading order. This is Hebrew locale on an...
7
by: ChrisUttenreither | last post by:
Hello folks. I'm writing a Roguelike game in C#. Fun stuff. The game includes a map that is made entirely of colored ASCII art in a monospace font. I would like to make this map a control in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.