Go4Expert (http://www.go4expert.com/)
-   Programming (http://www.go4expert.com/forums/programming-forum/)
-   -   VB-2010 accessing a public string variable (http://www.go4expert.com/forums/vb-2010-accessing-public-string-variable-t26260/)

JCT 12Jul2011 04:11

VB-2010 accessing a public string variable
Upfront, I am quite new to Visual Basic.

My question: How can I "pass" or reference a simple string variable across 2 forms.

I start my main form with:
PublicClass Interface
Public Namevar AsString

Now then, I want to fire up a subform, SubSearch with a button click. So:

PrivateSub SearchRun_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SearchRun.Click

So far so good.
However, I want to use Namevar within SubSearch. Since I initially declared Namevar as Public, I thought it's value would be available in my Subform. But everything I have tried has failed.

Any help will be appreciated.


All times are GMT +5.5. The time now is 23:38.