How Do You Share Variables Between Modules in VB.NET ?

G

Gordon

Does anyone know how to do this ?

I have a variable called LABEL1 in my FORM1.VB declared as PUBLIC WITHEVENTS
and I have another module, MODULE1.VB, which needs to reference LABEL1.
However, when compiling my project, I get a 'variable is not declared'
message at the line where I reference LABEL1 thus :

MODULE1.VB
----------------

Label1.Text = "Anything at all" <------------------- This produces
the error.


Any ideas ?

Gordon.
 
H

Herfried K. Wagner [MVP]

* "Gordon said:
I have a variable called LABEL1 in my FORM1.VB declared as PUBLIC WITHEVENTS
and I have another module, MODULE1.VB, which needs to reference LABEL1.
However, when compiling my project, I get a 'variable is not declared'
message at the line where I reference LABEL1 thus :

MODULE1.VB

You will need a reference to the label in the module (the procedure in
the module).

See (complete thread):

<http://groups.google.de/groups?selm=uhY85s#[email protected]>

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

Dilbert's words of wisdom #18: Never argue with an idiot. They drag you down
to their level then beat you with experience.
 
G

Gordon

Herfried,

I just got rid of Module1, stuck the code that was there into Form1.vb and
it all works great now.

Many thanks for your patience and understanding towards a 'traditional'
programmer trying to learn new technologies :)

Gordon.
 
H

Herfried K. Wagner [MVP]

* "Gordon said:
I just got rid of Module1, stuck the code that was there into Form1.vb and
it all works great now.

Nice solution.

;-)

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

Dilbert's words of wisdom #18: Never argue with an idiot. They drag you down
to their level then beat you with experience.
 

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