msgbox doesn't show the text.

Joined
Nov 13, 2007
Messages
5
Location
India
Programming Experience
Beginner
Hi all,
I'm new to .net Technologies and am currently working on 1.1 Framework i.e .net 2002. I wrote a small program where i am trying to display a simple message "Hi". When i execute the program it gives me no error, it gives the message dialog but it doesn't show me the message "Hi". Kindly suggest. FYI, I used double quotes to form string Hi. Also when i use Debug.WriteLine("Hi") i'm able to see the message in output window. Kindly suggest.

Regards,
Harsha
 
Harsha,

All you should need is one of these (The second is a hold over from VB6 I think, so you'll probably want to use the first one):

VB.NET:
MsgBox("Hi")

MessageBox.Show("Hi")

But you say that you can get the message box to appear, but theres no text in it? I've never heard of that before...

Maybe if you posted your code we could get a better idea of the problem.

- Dan
 
Harsha,

All you should need is one of these (The second is a hold over from VB6 I think, so you'll probably want to use the first one):

Other way round, dear boy. MsgBox is legacy, MessageBox.Show is preferred
 
To find out an entire list of all the sins you commit, uncheck the Microsoft.VisualBasic reference in the project references ;)

All your Left, Mid, InStr etc calls, suddenly become compiler errors..

Note that the DLL is needed if you tick "Use application framework" for stuff like Single Instance apps, so you might not remove it completely (and even we C# boys use the VB dll for single instancing because it's nicely implemented way of achieving the goal)
 
Hi All,
Thanks a lot for your guidance to help me learn VB.net :)
FYI, I searched my guide to see if there is any other predefined function to do that
job and Now i'm able to see the message text on the message dialog :)

Function that worked is MessageBox.show("Hi") This is exactly the same function
that you good ppl have suggested me.
I think this is newly included in .net.... but what abt msgbox("Hi") This still works the
same way as i reported in my query... If this function was made absolute then why
does not VB.net give any error? Why is it being supported even though we cannot
see any message text supplied to that function? Is there any hidden use of it? FYI, again i say that i'm working
on Framework 1.1 and VS.net 2002. Does it have to do anything with the framework and .net Version? Kindly
suggest.
 
Last edited:
VS.NET 2002 targets .NET Framework version 1.0, not 1.1. .NET 1.1 came along with VS.NET 2003.

MsgBox and a whole host of other functions were included in VB.NET mainly so a lot of VB6 developers wouldn't whine so much. Some of the Runtime functions are useful but most, including MsgBox do nothing useful that can't be done just as easily another way.

I'm not sure why you don't see anything using MsgBox because it should work. Given that it adds no value though, there's no point trying to work out why.

Just one more point. This:
VB.NET:
MsgBox("Hi")
is actually equivalent to this:
VB.NET:
MessageBox.Show("Hi", Application.ProductName)
 
Hi jmcilhinney
You are right that MsgBox("HI") is no different from MessageBox.Show("Hi", Application.ProductName) but what i reported as happening is happening in real. Can it be because of .net version/ framework.
 
Hi jmcilhinney
You are right that MsgBox("HI") is no different from MessageBox.Show("Hi", Application.ProductName) but what i reported as happening is happening in real. Can it be because of .net version/ framework.

Dude, it's just your install that's borked. The rest of the world has no complaints. Get over it (and use the new code, not the legacy - it'll make you a better coder anyways):
 

Attachments

  • screencap.wmv.zip
    36.7 KB · Views: 22
i'm working
on Framework 1.1 and VS.net 2002.

Not possible.

2002 = .NET 1.0

This is as hard, and fixed as it is that MS Word 97 makes MS Word 97 files, not MS Office 2003 ones. Having .NET 1.1 installed does NOT mean VS2002 will produce .NET 1.1 EXEs
 
Hi All,
Thanks a lot for your valuable suggestions :) As suggested above I would now try to reinstall .net and see if it works fine then... also thanks for correcting me about the version :)
 
Back
Top