I have three separate forms.
Form1, Form2, and Form3

I declared Public var1 as Integer within Form1.
Form2 and Form3 can see/access var1 as Form1.var1

However,
when I declare Public var2 as Integer within Form2 (when it opens), Form3 (when opened) cannot access var2 whatsoever.

Don't know what I'm missing. Perhaps a fundamental rule for declaring/using Public variables???

Help is appreciated.

Thanks.

In visual basic 6.0, of which you have posted your question in the wrong forum, public form variables are access via form1.variablename

Good Luck

I have three separate forms.
Form1, Form2, and Form3

I declared Public var1 as Integer within Form1.
Form2 and Form3 can see/access var1 as Form1.var1

However,
when I declare Public var2 as Integer within Form2 (when it opens), Form3 (when opened) cannot access var2 whatsoever.

Don't know what I'm missing. Perhaps a fundamental rule for declaring/using Public variables???

Help is appreciated.

Thanks.

Just create a Module and declare all your Public variables there.
you can access all those variables anywhere in your program

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.