473,811 Members | 3,701 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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 DefaultNamespac e.System.Window s.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.W indows.Forms.Fo rm()

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 1652
jd*******@gmail .com wrote in news:e3d5a2bc-a1fd-4095-b417-
2d**********@n2 2g2000prh.googl egroups.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**********@ro gers.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...@r ogers.comwrote:
jdlwri...@gmail .com wrote in news:e3d5a2bc-a1fd-4095-b417-
2d7906bfa...@n2 2g2000prh.googl egroups.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...@ro gers.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
3807
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 data that they were entering. Following is all exception information. Any thoughts much appreciated. Cheers
4
332
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
1439
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 unable to access the class from the first without qualifying it, which is what i want to avoid. Any ideas what I am doing wrong? I am attaching the code and compiler error below to show exactly what I am trying to do,
17
2080
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 write a signature for the developer and after getting a good start developing a 2.0 application I thought I should go through the code and start marking classes and with namespaces. I keep getting the following 'missing' error even when using a first...
5
1606
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
1344
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 MyNamespace.Foo
6
2475
by: douglass_davis | last post by:
Is the whole System namespace automatically imported?
3
4038
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 selects? thanks...
2
4505
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 boxes (please see associated source code below): 1) Win32 API with context ("btnWin32WithContext_Click") 2) .NET Framework with context ("btnFrameworkWithContext_Click") 3) Win32 API withOUT context ("btnWin32WithOUTContext_Click")
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10651
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10405
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10136
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7671
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6893
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5556
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4342
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3020
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.