Importing namespace does not work??

A

al

Hi,

I tried to import Drawing namespace and then declare one of its
classes, but this seems does not work with me.


Imports System.Drawing

Dim gr as Graphics = MyForm.CreateGraphics 'This give error; Type
expected

Dim gr as Drawing.Graphics = MyForm.GreateGraphics 'This works


Do I have to reference any DLL or something??


MTIA,
Grawsha
 
S

Scott M.

Did you first make a reference to the correct assembly? Imports statements
don't make the assembly (and its classes) available to you, they only make
it so that you don't have to fully qualify the class name with the namespace
it belongs to.
 
A

al

Scott M. said:
Did you first make a reference to the correct assembly? Imports statements
don't make the assembly (and its classes) available to you, they only make
it so that you don't have to fully qualify the class name with the namespace
it belongs to.

I did not make any reference to any assembly since the assembly I
needed(system.drawing) is already referenced by default in the
solution explorer.

Is there another way of referencing assemblies if they are refeneced
by default in the solution explorer??


Grawsha
 
H

Herfried K. Wagner [MVP]

* (e-mail address removed) (al) scripsit:
Is there another way of referencing assemblies if they are refeneced
by default in the solution explorer??

No.
 
S

Scott M.

Both of your versions work for me if instead of using the form name
(myForm), I use "me".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top