Solved

VB.net Imported Name spaces

Posted on 2012-03-11
2
216 Views
Last Modified: 2012-03-11
Hi

I am using third party software in Visual Studio and notice that although I have added references to their software that the relevant items are not ticked in the import name spaces at the bottom of the project references window. Should I check these boxes? Will it make it easier to use and how?
0
Comment
Question by:murbro
2 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 37707599
Importing a namespace means you don't have to "fully qualify" the type name within your code. For example whereas you can type this in your code:

System.Console.WriteLine("Hello World!")

Open in new window


Do you really want to type "System" every time you want to write to the console? Instead, we often do:

Imports System

...

Console.WriteLine("Hello World!")

Open in new window


This may seem trivial for this example, but when you start getting into deeper namespaces, then the savings becomes apparent (e.g. System.Collections.Generic).

As far as checking the boxes, that is up to you. You can either check the boxes, or you can put the "Imports" statement within each file that uses something from that namespace. I believe if you check the boxes, then the imports are application-wide, whereas putting them within each file makes the import applicable just to that file.
0
 

Author Closing Comment

by:murbro
ID: 37707684
thanks very much
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question