What is the difference between 'Add a reference of assembly' and 'import a namespace'

akhhttar

Active member
Joined
Aug 6, 2005
Messages
28
Location
Bahawalpur-Pakistan
Programming Experience
1-3
hi,
Can anybody guide me that what is the difference between 'Add a reference of assembly' and 'importing a namespace ' in our vb.NEt project.
i m really confuise about that.
for example what will be the difference if i add reference of 'System.Runtime.Remoting' in my project OR 'using System.Runtime.Remoting'
 
The Imports statement allows you to use a type of shorthand to the imported namespace in the file in which the Imports statement is used. You can also have Project Imports which apply to all files in the project. (to set those, go to the Project's Property pages and click on Imports under the 'Common Properties' folder on the left hand side). By default Visual Studio creates several Project Imports for you when you create a winform app, one being the System.Windows.Forms namespace. Since you have that Import, you can type for instance 'Dim myButton As Button' instead of 'Dim myButton As System.Windows.Forms.Button'. You don't have to type the namespace since it has been imported.
Now any Imported namespace will need a reference to that namespace. You add a reference by right clicking the 'References' node in the solution explorer.
 
Back
Top