Thursday, November 11, 2010

I want a variable declared in one Form of VB.NET to be accessed in another Form, How is it possible?

For example i declared a variable in Form1 and the done some manipulation with the variable, now i want that variable in Form2 with the value in Form1..

With regards

vinothI want a variable declared in one Form of VB.NET to be accessed in another Form, How is it possible?
Declare the variables as Globals within a module, instead of variables within a form.



Instead of

Dim strMyString as String

in a form's code,



put

Global strMyString as String

in a module.I want a variable declared in one Form of VB.NET to be accessed in another Form, How is it possible?
you can use session variables to communicate between forms, like

session(';x';) = 1000


system.form2.variable = whatever.

No comments:

Post a Comment