473,395 Members | 1,613 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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

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
3 1629
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Greg Bacchus | last post by:
Hi, I'm getting an exception that really has me stumped. It's sporadic at best, it's only happened a handful of times. This particular time it happened when the user pressed 'Alt-S' to save the...
4
by: Bernard Bourée | last post by:
Hello When I try to import the System.Windows.Forms.MessageBox I get a meesage saying that it is not avalaible ? How to solve it ? Thanks Bernard
7
by: Aniket Sule | last post by:
Hi, I am trying to use a class from one namespace in another via the using directive. The 2 namespaces have some part of the name in common (A.B.x, A.B.y). However in the second namespace, I am...
17
by: clintonG | last post by:
Using 2.0 with Master Pages and a GlobalBaseClass for the content pages. I understand the easy part -- the hierarchical structure of a namespace naming convention -- but the 2.0 IDE does not...
5
by: Davíđ Ţórisson | last post by:
I've never understood fully, why do I have to td eg: using system; using system.data; I would have thought that the top line imports system and all of its submembers, including data??
7
by: Dylan Parry | last post by:
Hi, I've started to get a bit confused by namespaces and hierarchical organisation in general. What I want to do is something like this: Namespace MyNamespace | |- Class Foo | |- Namespace...
6
by: douglass_davis | last post by:
Is the whole System namespace automatically imported?
3
by: forest demon | last post by:
for example, let's say I do something like, System.Diagnostics.Process.Start("notepad.exe","sample.txt"); if the user does a SaveAs (in notepad), how can i capture the path that the user...
2
by: =?Utf-8?B?TmF0aGFuIFdpZWdtYW4=?= | last post by:
Hi, I am wondering why the .NET Framework is quite different from Win32 API when it comes to displaying system modal message boxes. Consider the four following types of system modal message...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.