C# / VB.NET inline namespaces, how can I do: New System.Windows.Forms.MessageBox?

J

jdlwright

Hi, if someone could answer this please I would be grateful - I have
looked online but can't find the answer.

In C# I can do this for example

m = new System.Windows.Forms.Form()

but of course in VB.NET the same would be wrong

m = New System.Windows.Forms.Form()

because of the default namespace, I'd really be saying

m = New DefaultNamespace.System.Windows.Forms.Form()

okay, fair enough, so how do I get out of the default namespace (or
can I even)?

eg. something like
m = New Global.System.Windows.Forms.Form()

Sure I can do

Imports System.Windows.Forms
.....
m = New Form

but sometimes I'm too falsely lazy to hit home, type it in and then
ctrl -


Thanks
Jim
 
G

Guest

(e-mail address removed) wrote in (e-mail address removed):
but of course in VB.NET the same would be wrong

m = New System.Windows.Forms.Form()

because of the default namespace, I'd really be saying

Try:

Dim m = New System.Windows.Forms.Form()
 
J

jdlwright

Ah, yeah playing now I see. Ok, so my question was wrong. My real
problem was I was already in a similar namespace

eg.

Namespace X.Y

within which you can't do

Public Shared b As X.C

can in C# but not in VB - don't know why, will just live with it.

Sorry for not checking what I was asking after I reduced it...

Jim
 
C

Cor Ligthert[MVP]

Jim,

Don't fool up here what you cannot do in VB however in C#.

Most VB programmers have a better knowledge about C# than visa versa.

Cor
 

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

Top