473,698 Members | 2,576 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem displaying a messageBox in .NET CF

2 New Member
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 1765
Plater
7,872 Recognized Expert Expert
What's wrong with just using System.Windows. Forms.MessageBo x.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
alexbisson
2 New Member
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.MessageBo x.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
3540
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) template. Briefly -------------------------------------------------------------------------------------------- I need to create dynamically some controls on the forms, and display these
11
541
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 sizes properly so I know there is a message in there. I also found a keyboard shortcut where <ctrl>+<insert> will copy the contents of the messagebox to the clipboard in plain text. I see my messagebox text in the clipboard contents but not in the...
6
7478
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 "System.Data.DataR..." is displayed inside the combobox is the amount of records in the dataset. On the other hand, if my query is "select emplcode from payemployee", the databind will work fine (but I don't want to limit the dataset to one field)....
3
3696
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 MyForm()); It works : when i click then i have the messagebox and the form still continues its message loop.
5
15813
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 DataView_Filter = new DataView(); DataView_Filter.Table = DS_States.Tables; sFilter = "Emplcode = '123233'"; DataView_Filter.RowFilter = sFilter; MessageBox.Show (DataView_Filter.Count.ToString()); //it displays 6
20
8896
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 works just fine. If I put the call in the .cpp file, I get the following two errors: error C2653: 'MessageBoxA': is not a class or namespace name error C2660: 'System::Windows::Forms::Control::Show': function does not take
16
4915
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 Microsoft must be installed on their servers. Now german Umlaute (ä, ü, ö) and quotes are returned incorrectly in SOAP fault responses. This can be easily verified: Implement the following in a web service method (just raises a SOAPException with a...
4
2240
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 English Windows machine. I know there is a constant MB_RTLREADING or osmething, but I cannot use that as the program has to run in a number of different languages. Shouldn't it automatically change to RTL if I change the locale to Hebrew? Any...
7
2468
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 the main form. My first attempt was with RichTextBox. I wanted to set the background to black. After cruising newsgroups I determined that wasn't possible. My second attempt involves an AxSHDocVw.AxWebBrowser control. I got this by adding...
0
8680
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9169
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9030
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4371
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2335
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.