Dim Public?

I set a variable in the top of a form Class but then in another form I can't see it. I thought that if something is public it would be seen everywhere. How can I have it seen in anther form/class?
Who is Participating?
Éric MoreauSenior .Net ConsultantCommented:
Hi szx248,

It is visible if you own the instance of this other class:

dim x as new Form1
'Now you have access to public variables of Form1 using the variable X
x.PublicVariable = Something

I belive you want to make it Public Shared. Then to access it in another form you do:


where fromname is the name of the form where the variable is declared.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.