Msgbox vs Messagebox

  • Thread starter Thread starter Richard
  • Start date Start date
R

Richard

Hi,
Both does the same thing(atleast for me).
Which is preffered to use in vb.net and why.

RC
 
Hi,
Both does the same thing(atleast for me).
Which is preffered to use in vb.net and why.

RC

MsgBox is just a wrapper for MessageBox. I prefere to cut out the
middle man and just use MessageBox. I think the whole thing boils down
to use what you like best :)
 
C# programmers won't make fun of you. In general it's probably a good
choice to avoid the compatibility library. On a more serious note though, I
belive they have different return values, but I'm not positive on that one.
 
W.G. Ryan eMVP said:
C# programmers won't make fun of you. In general it's probably a good
choice to avoid the compatibility library.

'MsgBox' is part of "Microsoft.VisualBasic.dll", which is not the
compatibility library.
 
Richard said:
Both does the same thing(atleast for me).
Which is preffered to use in vb.net and why.

I prefer 'MsgBox' because it's faster to type and IMO better readable.
 
Richard,

I prefer messagebox above msgbox with msgbox I get always such a strange
feeling in my throat when I type it.

What a crazy answers you get on your question (except from Tom)

Just take what *you* prefer as Tom says.

Cor
 
Hi,
Both does the same thing(atleast for me).
Which is preffered to use in vb.net and why.

I wouldn't say either is globally preferred, it's more personal
preference and style. You'll find that this is true of most of the
functionality that's duplicated in both the System.* and
Microsoft.VisualBasic.* namespaces. Over time, most vb programmers fall
into a mix of the two that is comfortable for them, depending on
personal style and professional situation.

Personally, I prefer MessageBox.Show for a number of reasons:

It allows you to specify owner window, rather than have vb guess at it.

It's standard framework rather than VB-specific, so users of other
languages recognize it.

It's type-safe.

It's not always there by default. This gives you just a little bit added
protection against doing UI things in non-UI classes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top