use of imports

Pace

Well-known member
Joined
Sep 2, 2005
Messages
90
Location
Manchester UK! :)
Programming Experience
1-3
Hi,

Can someone briefly explain to me why you would add references to importing objects? is it so you can use the methods of that object on your form?

Also say you want to do a particular task. is their a way of searching for a method to do this ?

Either a link or a quick heads up...

for example i see text like this...

VB.NET:
 imports system.data.sqlclient
 
adding imports statments simply allows you to omit full namespace prefix's

eg

without any imports statement i use the following

Dim carColor as System.Drawing.Color

with imports System.Drawing i would use the following

dim carColor as Color

just making it less coding, but on the other hand without the imports statements u tend to learn where things are!

also, if you import 2 namespaces that both contain a Color then you will get an ambigious error if you use the dim carColor as Color statment

which leads onto your 2nd question, is there a quick and easy way to find what you want? in short nope, easiest is to search on the MSDN

HTH,
Craig
 
Thank you Craig!
 
Back
Top