473,803 Members | 3,159 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MessageBox Issues

I always thought writing a simple diagnostic message in a message box would
be pretty simple. Not in .NET.

First, I wrote this amazingly complex piece of code:

MessageBox.Show ("yer mama")

It wouldn't even complile. "Gee...", I mused. "Maybe there's no reference
to that method in my project". I muzed correctly. So I added a reference
to System.Windows. Forms, which is where our beloved "MessageBox " method
resides.

Nothing. So at the top of my file, I wrote:

Imports System.Windows. Forms

Still, it wouldn't compile. Finally, I prefixed my call to MessageBox like
this:

System.Windows. Forms.MessageBo x.Show("yer mama")

It compiles now, but I never see "yer mama" anywhere on the screen. It's
inside this function:

Private Sub DropDownList1_S electedIndexCha nged(ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
DropDownList1.S electedIndexCha nged

System.Windows. Forms.MessageBo x.Show("Yer mama")

End Sub

Maybe it's just not firing this sub, but that's kinda why the diagnostic is
there. I wanna find out if it is. Does this really have to be so
complicated?

I've run into situations in the past where I've had to spell out simple
methods by fully qualifying their namespaces. Why is that? Shouldn't it be
enough that they're listed under "references " in the solution explorer? Or
even written manually at the top of the file?

Any insights you can give me would be greatly appreciated.


Nov 18 '05 #1
5 1560
Hi
try
msgbox("Hello")

:)

"Curt Emich" <ce****@comcast .net> wrote in message
news:QO******** ************@co mcast.com...
I always thought writing a simple diagnostic message in a message box would be pretty simple. Not in .NET.

First, I wrote this amazingly complex piece of code:

MessageBox.Show ("yer mama")

It wouldn't even complile. "Gee...", I mused. "Maybe there's no reference to that method in my project". I muzed correctly. So I added a reference
to System.Windows. Forms, which is where our beloved "MessageBox " method
resides.

Nothing. So at the top of my file, I wrote:

Imports System.Windows. Forms

Still, it wouldn't compile. Finally, I prefixed my call to MessageBox like this:

System.Windows. Forms.MessageBo x.Show("yer mama")

It compiles now, but I never see "yer mama" anywhere on the screen. It's
inside this function:

Private Sub DropDownList1_S electedIndexCha nged(ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
DropDownList1.S electedIndexCha nged

System.Windows. Forms.MessageBo x.Show("Yer mama")

End Sub

Maybe it's just not firing this sub, but that's kinda why the diagnostic is there. I wanna find out if it is. Does this really have to be so
complicated?

I've run into situations in the past where I've had to spell out simple
methods by fully qualifying their namespaces. Why is that? Shouldn't it be enough that they're listed under "references " in the solution explorer? Or even written manually at the top of the file?

Any insights you can give me would be greatly appreciated.


Nov 18 '05 #2
"Curt Emich" <ce****@comcast .net> wrote in message
news:QO******** ************@co mcast.com...
It wouldn't even complile. "Gee...", I mused. "Maybe there's no reference to that method in my project". I muzed correctly. So I added a reference
to System.Windows. Forms, which is where our beloved "MessageBox " method
resides.

Nothing. So at the top of my file, I wrote:

Imports System.Windows. Forms

Still, it wouldn't compile. Finally, I prefixed my call to MessageBox like this:
It should. What compiler error message did it give you? That should be
enough.
Maybe it's just not firing this sub, but that's kinda why the diagnostic is there. I wanna find out if it is. Does this really have to be so
complicated?
If you want to tell if the event handler is being executed, a breakpoint
would probably be better. Also, you might want to think about the
Debug.Write and Debug.WriteLine methods, in the System.Diagnost ics
namespace. You don't have to add any extra references for those, and the
namespace is imported at the project level by default. Just make sure
you're targeting a Debug build.
I've run into situations in the past where I've had to spell out simple
methods by fully qualifying their namespaces. Why is that? Shouldn't it be enough that they're listed under "references " in the solution explorer?


There are a lot of namespaces, and some of them have identical class
names. If everything was automatically imported, it would clog up the IDE
and lead to a lot of ambiguity. Odds are your code would have to use the
fully-qualified name -more- that way.

Jeremy

Nov 18 '05 #3
As the namespace implies, the MessageBox method is for windows forms
applications.
In an ASP.NET environment your client is a web browser, therefore you should
use client side code such as javascript to display a message box on the
client.

Execute a line of code like this when you want a message box to be
displayed.
(This writes out the necessary client side javascript to your HTML page to
make the alert pop up as soon as the page is sent to their browser.)

RegisterStartup Script("startup Script", "<script
language=JavaSc ript>alert('Thi s is my message.');</script>");

Here's more info:
http://msdn.microsoft.com/library/de...criptTopic.asp

Here are a couple controls you might find to be useful:
http://www.metabuilders.com/Tools/ConfirmedButtons.aspx
http://www.jttz.com/msgbox/index.htm

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com
"Curt Emich" <ce****@comcast .net> wrote in message
news:QO******** ************@co mcast.com...
I always thought writing a simple diagnostic message in a message box would be pretty simple. Not in .NET.

First, I wrote this amazingly complex piece of code:

MessageBox.Show ("yer mama")

It wouldn't even complile. "Gee...", I mused. "Maybe there's no reference to that method in my project". I muzed correctly. So I added a reference
to System.Windows. Forms, which is where our beloved "MessageBox " method
resides.

Nothing. So at the top of my file, I wrote:

Imports System.Windows. Forms

Still, it wouldn't compile. Finally, I prefixed my call to MessageBox like this:

System.Windows. Forms.MessageBo x.Show("yer mama")

It compiles now, but I never see "yer mama" anywhere on the screen. It's
inside this function:

Private Sub DropDownList1_S electedIndexCha nged(ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
DropDownList1.S electedIndexCha nged

System.Windows. Forms.MessageBo x.Show("Yer mama")

End Sub

Maybe it's just not firing this sub, but that's kinda why the diagnostic is there. I wanna find out if it is. Does this really have to be so
complicated?

I've run into situations in the past where I've had to spell out simple
methods by fully qualifying their namespaces. Why is that? Shouldn't it be enough that they're listed under "references " in the solution explorer? Or even written manually at the top of the file?

Any insights you can give me would be greatly appreciated.


Nov 18 '05 #4
Hi Steve,

I think that I would not have seen this, however I look to it from the
languages.vb group, when it was in the aspnet group, I would have seen.

I message this to point the OP hat this message is in my opinion the right
one, there are so much which are for the windowform, that he can become
confused.

And have nothing to add.

Cor
Nov 18 '05 #5
Maybe it does not like "yer mama" in the message box?
Curt, looking at your example code below, your message box is in the event
firing on a DropDownList1, which is an ASP component, so you are talking
about using MessageBox in an ASP page, right? If so, it won't work.

"Curt Emich" <ce****@comcast .net> wrote in message
news:QO******** ************@co mcast.com...
I always thought writing a simple diagnostic message in a message box would be pretty simple. Not in .NET.

First, I wrote this amazingly complex piece of code:

MessageBox.Show ("yer mama")

It wouldn't even complile. "Gee...", I mused. "Maybe there's no reference to that method in my project". I muzed correctly. So I added a reference
to System.Windows. Forms, which is where our beloved "MessageBox " method
resides.

Nothing. So at the top of my file, I wrote:

Imports System.Windows. Forms

Still, it wouldn't compile. Finally, I prefixed my call to MessageBox like this:

System.Windows. Forms.MessageBo x.Show("yer mama")

It compiles now, but I never see "yer mama" anywhere on the screen. It's
inside this function:

Private Sub DropDownList1_S electedIndexCha nged(ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
DropDownList1.S electedIndexCha nged

System.Windows. Forms.MessageBo x.Show("Yer mama")

End Sub

Maybe it's just not firing this sub, but that's kinda why the diagnostic is there. I wanna find out if it is. Does this really have to be so
complicated?

I've run into situations in the past where I've had to spell out simple
methods by fully qualifying their namespaces. Why is that? Shouldn't it be enough that they're listed under "references " in the solution explorer? Or even written manually at the top of the file?

Any insights you can give me would be greatly appreciated.


Nov 18 '05 #6

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

Similar topics

4
2815
by: Mystery Man | last post by:
We have developed a CSharp program that has a secondary thread that is used to perform background operations. This secondary thread may display some MessageBoxes or Forms. However, if the secondary thread is aborted, then the MessageBox control does not get deleted. The forms do. I am unsure why this should be the case because MessageBox is also derived from System.Windows.Forms. Is there any way I can get the MessageBoxes to be...
7
16978
by: Bill | last post by:
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?
6
4031
by: tma | last post by:
How are message boxes (not the browser pop-up variety but rather the .NET msgbox) achieved in ASP.NET?
5
1339
by: Curt Emich | last post by:
I always thought writing a simple diagnostic message in a message box would be pretty simple. Not in .NET. First, I wrote this amazingly complex piece of code: MessageBox.Show("yer mama") It wouldn't even complile. "Gee...", I mused. "Maybe there's no reference to that method in my project". I muzed correctly. So I added a reference to System.Windows.Forms, which is where our beloved "MessageBox" method
4
7352
by: harvie wang | last post by:
Hi, I want to add more buttons to messagebox, such as "Apply All". Can i implement a custom messagebox, inherite from System.Windows.Form.MessageBox? Best wish, harvie 2006-1-18
2
6493
by: randy1200 | last post by:
I have the following line of C# code: MessageBox.Show(filesThatDoNotExist, "Files Not Found", MessageBoxButtons.OK); This line generates the following warning when I select "Run Code Analysis" CA1303 : Microsoft.Globalization : Form1.btnGenerateDocuments_Click(Object, EventArgs):Void passes a literal as parameter 2 of a call to MessageBox.Show(String, String, MessageBoxButtons):DialogResult. Retrieve the following string argument...
6
3500
by: Goran Djuranovic | last post by:
Hi all, I have a VB.NET windows application that uses MDI form. When I try to delete a datagrid row from one of the MDI children forms, I use a MessageBox YesNo confirmation, which, after confirmed, minimizes the MDI form. Why is this happening and how can I prevent it? Important thing to say is, if I use just "OK" MessageBox, it DOES NOT minimize the MDI parent. TIA Goran
2
4910
by: =?Utf-8?B?ZGxpbmdn?= | last post by:
I have a simple c# windows form with a textbox and button that, when clicked, displays a simple MessageBox. With the cursor in the textbox, I can select the Japanese language and desired Input Mode (Hiragana, Full-Width Katakana, etc) from the IME toolbar. However, when the click on the button to display the MessageBox then return to the text, the Input Mode on the IME switches to "Direct Input", regardless of what it was originally...
6
21560
by: Frank Rizzo | last post by:
I am trying to programmatically close a messagebox. I don't see any obvious managed choices. Back in the day, I remember using a combination of FindWindow and EndDialog apis( http://msdn2.microsoft.com/en-us/library/ms645472.aspx ), but how can I ensure that the dialog that I am destroying actually belongs to my application? Thanks.
0
9700
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
9564
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
10546
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
10068
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
5498
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...
0
5627
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4275
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
2
3796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2970
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.