473,797 Members | 2,970 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MessageBox.Show is showing BEHIND the application

For some reason, I have an errormessage popup that "blinks", but pops up
BEHIND the applications, which is confusing to users.

Is there any way to force it to the top?
Nov 16 '05 #1
7 16976
Hi Bill,
I can't reproduce your problem. However try to pass reference to the form as
messagebox' owner.

If it doesn't help I would suggest you to post some code that demonstrates
the problem.
--

Stoitcho Goutsev (100) [C# MVP]
"Bill" <nf*@nospam.com > wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
For some reason, I have an errormessage popup that "blinks", but pops up
BEHIND the applications, which is confusing to users.

Is there any way to force it to the top?

Nov 16 '05 #2
Bill,
Are you using one of the overloads to MessageBox.Show that expects the
IWin32Window owner parameter?

Control implements IWin32Window, so you can just pass you current form
(this).

Hope this helps
Jay
"Bill" <nf*@nospam.com > wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
For some reason, I have an errormessage popup that "blinks", but pops up
BEHIND the applications, which is confusing to users.

Is there any way to force it to the top?

Nov 16 '05 #3
"Stoitcho Goutsev (100) [C# MVP]" <10*@100.com> wrote in message
news:u9******** ******@TK2MSFTN GP12.phx.gbl...
Hi Bill,
I can't reproduce your problem. However try to pass reference to the form as messagebox' owner.

If it doesn't help I would suggest you to post some code that demonstrates
the problem.
--

Stoitcho Goutsev (100) [C# MVP]


I am displaying the error message as follows:

private void SummaryView_Loa d(object sender, System.EventArg s e)
{
try
{
twsDS1 = SummaryBO.Insta nce.twsDS;
}
catch (Exception err)
{
MessageBox.Show ("Data Error:\n" + err.Message);
return;
}
}
Nov 16 '05 #4
Bill,
What Stoitcho & I are suggesting is:

MessageBox.Show (this, "Data Error:\n" + err.Message);

As long as SummaryView_Loa d is in a form.

Also, rather scattering try/catch/MessageBox all over my app I would use a
global exception handler with a single try/catch/MessageBox that is able to
log the exception & show it to the user.

Depending on the type of application you are creating, .NET has three
different global exception handlers.

For ASP.NET look at:
System.Web.Http Application.Err or event
Normally placed in your Global.asax file.

For console applications look at:
System.AppDomai n.UnhandledExce ption event
Use AddHandler in your Sub Main.

For Windows Forms look at:
System.Windows. Forms.Applicati on.ThreadExcept ion event
Use AddHandler in your Sub Main.

It can be beneficial to combine the above global handlers in your app, as
well as wrap your Sub Main in a try catch itself.

There is an article in the June 2004 MSDN Magazine that shows how to
implement the global exception handling in .NET that explains why & when you
use multiple of the above handlers...

http://msdn.microsoft.com/msdnmag/is...T/default.aspx

For example: In my Windows Forms apps I would have a handler attached to the
Application.Thr eadException event, plus a Try/Catch in my Main. The
Try/Catch in Main only catches exceptions if the constructor of the MainForm
raises an exception, the Application.Thr eadException handler will catch all
uncaught exceptions from any form/control event handlers.

Hope this helps
Jay
"Bill" <nf*@nospam.com > wrote in message
news:On******** *****@TK2MSFTNG P11.phx.gbl...
"Stoitcho Goutsev (100) [C# MVP]" <10*@100.com> wrote in message
news:u9******** ******@TK2MSFTN GP12.phx.gbl...
Hi Bill,
I can't reproduce your problem. However try to pass reference to the form
as
messagebox' owner.

If it doesn't help I would suggest you to post some code that

demonstrates the problem.
--

Stoitcho Goutsev (100) [C# MVP]


I am displaying the error message as follows:

private void SummaryView_Loa d(object sender, System.EventArg s e)
{
try
{
twsDS1 = SummaryBO.Insta nce.twsDS;
}
catch (Exception err)
{
MessageBox.Show ("Data Error:\n" + err.Message);
return;
}
}

Nov 16 '05 #5
Hello, Bill!
I don't have MessageBox control in the list of the controls.
When I manually create:
System.Windows. Forms.MessageBo x a=new MessageBox();
The code compiles, but I see a warning:
System.Windows. Forms.MessageBo x is inaccessible due to its protection level

What the heck is it and how do I change the protection level?

With best regards, Nurchi BECHED.
Nov 16 '05 #6
Nurchi,
MessageBox is not a Control per se, it is a "static" class the will display
a specific dialog box, the Win32 message box.

A "static" class is a class that only has static methods, you do no
instantiate an instance of the class to use it, you simply call the methods.

Something like:

MessageBox.Show (this, "Data Error:\n" + err.Message);

System.Windows. Forms.MessageBo x & System.Math are both example of a "static"
class.

Hope this helps
Jay

"Nurchi BECHED" <nu****@telus.n et> wrote in message
news:sNCOc.1504 $T_6.1359@edtnp s89...
Hello, Bill!
I don't have MessageBox control in the list of the controls.
When I manually create:
System.Windows. Forms.MessageBo x a=new MessageBox();
The code compiles, but I see a warning:
System.Windows. Forms.MessageBo x is inaccessible due to its protection level
What the heck is it and how do I change the protection level?

With best regards, Nurchi BECHED.

Nov 16 '05 #7
Hello, Jay!

Yes, but in the past there was a 'control' that you could put on your
form...
Just like OpenFileDialog or SaveFileDialog. ..
I was able to put that object on the form and then use it in my code...

You wrote on Sat, 31 Jul 2004 13:17:36 -0500:

JBH> A "static" class is a class that only has static methods, you do no
JBH> instantiate an instance of the class to use it, you simply call the
JBH> methods.

JBH> Something like:

JBH> MessageBox.Show (this, "Data Error:\n" + err.Message);

JBH> System.Windows. Forms.MessageBo x & System.Math are both example of a
JBH> "static" class.

JBH> Hope this helps
JBH> Jay

JBH> "Nurchi BECHED" <nu****@telus.n et> wrote in message
JBH> news:sNCOc.1504 $T_6.1359@edtnp s89...
??>> Hello, Bill!
??>> I don't have MessageBox control in the list of the controls.
??>> When I manually create:
??>> System.Windows. Forms.MessageBo x a=new MessageBox();
??>> The code compiles, but I see a warning:
??>> System.Windows. Forms.MessageBo x is inaccessible due to its protection
JBH> level
??>>
??>> What the heck is it and how do I change the protection level?
??>>
??>> With best regards, Nurchi BECHED.
??>>

With best regards, Nurchi BECHED.
Nov 16 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1608
by: Gerry Viator | last post by:
Hi all, Whats going on. Testing messagebox, text isn't showing up. Public Class Form1 Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code "
12
1455
by: Marc Jennings | last post by:
Hi, I have a problem with the message text and button text not showing up in a messagebox. (See attachment) The code I used to call this example was > MessageBox.Show(this,"Hello","nothing shown",MessageBoxButtons.OK,MessageBoxIcon.Information); I had this problem a couple of weeks ago when I was running Windows 2003 Server on my dev machine, and I put it down to an OS / Framework
10
2355
by: Russ | last post by:
I've been trying to figure out how to show a simple messagebox with an OK button in my web client program (C#). I have looked at every reference to JScript and MessageBox that seemed even remotely like it could help, both in the VS help and in this NG. I found lots of examples of people saying how easy it is and showing examples, and examples in the help. But I have two problems: 1. All the examples show all the code in HTML, usually...
13
5679
by: Chris | last post by:
I can create Javascript confirm message boxes during page creation, etc adding them to the button attributes (many good posts on this!). But how can I add this event after the button is pressed? I have created an Is_Dirty routine checking for field changes on my page then if the user clicks on the "exit" button I check for Is_Dirty = true and want to ask then "do you want to exit without saving?". It's a code behind where if the value of...
10
8299
by: Ed Bitzer | last post by:
One option of the messagebox object indicates it can be placed over a selected window rather than just appearing centered on the desktop. The function is "Overloads Public Shared Function Show(IWin32Window, String) As DialogResult" I have unsuccessfully tried: /// Dim winhandle as string Dim rtn as DialogResult winHandle = Me.Handle.ToString()
3
2690
by: Kiyomi | last post by:
Hello, I use in my application MessageBox.Show and it works perfectly when I run this application on my local computer (http://localhost). When I diployed this application on the server, however, it does not work. It does not give me even an error message, but the screen is just freezed (it is running open the page). What are the requirements for the MessageBox.Show to work ? I suppose something is missiong on the server as the same...
4
3697
by: TonyJ | last post by:
Hello! I have a small program that just copy a file and make some checks in main then I just want to inform the user about something by using a MessageBox. I tried to use this in the MessageBox that is located in the main function. This cause compile error because you are not allowed to use this in a static function.
1
4203
by: gewe | last post by:
I have a form (sizeable border, shows in taskbar, nothing unusual), which is the main form of my application (called MainForm). During an operation progress is shown in another form, that is shown from within the main form with: pf.Show(this); When I have to show a messagebox, the messagebox is shown behind the main form. The messagebox is shown from within the main form. I tried both: MessageBox.Show(this, ...); and:...
1
2077
by: Probi | last post by:
Hello I have a messagebox showing on the click of a button it is a yes/no message box and so far it works in the localhost with MessageBox.Show but when I publish the aspx page and run it on the server i get this error "Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a...
0
9536
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10468
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
10245
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...
0
10021
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...
0
9063
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7559
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
5458
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...
1
4131
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.