// sorry i accidentally posted this in VB.Net earlier.. in case you saw it before.

thought i'd make a program for fun.. although to be safe im cutting it up into many forms to save room. Anyway doing this means im going to have to get alot of the variables from the forms back to the original page, and then back to a different form for calculations.

This is a bit beyond my ability. I'm really not sure how to go about getting variables to work with more then one form.


Oh and im using Visual Basic 2005 express edition... in case it matters.

' There are multiple ways to achieve that:
' 1 Use Global Variables : Declare them as Public in a Module so that it becomes applicable to all modules
' 2 Pass By Reference : When you pass a variable as reference, you are actually refering the memory
' 3 Use Registry : You can store the value in registry and update it
' 4 Value in External Files: You can also have the value in an external file (ini file or text file )and read it (and write it) when necessary

ok well i have yet to try using an external file, Registry or Pass by reference.

i'd imagine my best bet would be pass by reference or Global variables though considering i plan on having alot of variables being passed back and forth.

how do i pass by reference?

In VB by default all variables will be passed by reference unless you explicitly pass it by value (using 'ByVal' keyword). I think you better use a public variable defined in a common module.

ok thanks alot.. now i shall read up on public variables in common modules

(i actually tried to do it without the reading part seems like it was a bad idea.. time to crack open a book)

Figured it out!

couldn't find it in a book but i finally figured it out..

im happy.

This article has been dead for over six months. Start a new discussion instead.