By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,660 Members | 995 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,660 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Jan 16 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
jd*******@gmail.com wrote in news:e3d5a2bc-a1fd-4095-b417-
2d**********@n22g2000prh.googlegroups.com:
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()

--
sp**********@rogers.com (Do not e-mail)
Jan 16 '08 #2

P: n/a
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

On Jan 16, 11:38*am, Spam Catcher <spamhoney...@rogers.comwrote:
jdlwri...@gmail.com wrote in news:e3d5a2bc-a1fd-4095-b417-
2d7906bfa...@n22g2000prh.googlegroups.com:
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()

--
spamhoney...@rogers.com (Do not e-mail)
Jan 16 '08 #3

P: n/a
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
Jan 17 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.