AnsweredAssumed Answered

Getting variable name from form vb.net

Question asked by Aj Jones on Dec 13, 2012
Latest reply on Dec 14, 2012 by Aj Jones

I have a couple of small SolidWorks program I wrote in vb.net. Each of them works fine and runs.  I then tried to make a program in vb.net that runs all of them.  So now there is a main menu form with different buttons that open different forms.  When the Enter button is selected on any of the forms, the corresponding Sub is called out.  Each program has its own module and each module has its own sub.

 

For some reason I cannot get variables from the forms the same way I previously did when the program was a single form with a single module with a sub.  The way I would get text from the form and set it as a variable in the module's sub was:

 

Sub Main1()

 

Dim Length As String

Length = Form1.Length.Text

 

End Sub

 

Now if I Click on the option in the Main Menu that opens Form1, fill out Form1 and hit enter, the enter button calls Main1, but the variable Length is never set now.  It worked fine when the programs were standalone, but now it won't and it is driving me nuts.

 

Does VB.NET do something different when you have multiple forms and modules?  Is there a different way I need to get the text from text boxes

 

Here is how the structure is set up:

 

Main Menu (3 Button options to select)

     Form1

          Module1

               Sub Main1

     Form2

          Module2

               Sub Main2

     Form3

          Module3

               Sub Main3

 

Thanks!

Outcomes