Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Accessing Different Instances Of One Form
Message
 
To
09/05/2002 12:50:09
Jason Dalio
Northern Interior Regional Health Board
Prince George, British Columbia, Canada
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00654590
Message ID:
00654816
Views:
25
Your instances needs to be declared more globally:
Dim NewPatientForm1 As frmPatient
Dim NewPatientForm2 As frmPatient

Private Sub cmdAddForm_Click
   NewPatientForm1.Show
   NewPatientForm2.Show
End Sub

Private Sub cmdDisplayValues

   debug.print NewPatientForm1.Text1.Text        'here I want NewPatientForm1
   debug.print NewPatientForm2.Text1.Text        'here I want NewPatientForm2
   Stop

End Sub
>I'm workign with multiple instances of a form for the first time and it's been going well till just now. I need to add nodes to a tree on a multiple instanced form from another modal form. When i try and add the node from the modal form it fires the Form_Load event of the form with the tree control. This was driving me nuts for awhile until i realized that I am not working with just the form itself but an instance of the form (I'm still guessing at this point but oh well). ow do I refernce a particular form if there are multiple instances?
>
>e.g. Below, how would I make my debug statements each reference one of the 2 newly created instances if the cmdDisplayValues is located on another form?
>
>
>Private Sub cmdAddForm_Click
>Dim NewPatientForm1 As frmPatient
>Dim NewPatientForm2 As frmPatient
>
>   NewPatientForm1.Show
>   NewPatientForm2.Show
>
>End Sub
>
>Private Sub cmdDisplayValues
>
>   debug.print frmPatient.Text1.Text        'here I want NewPatientForm1
>   debug.print frmPatient.Text1.Text        'here I want NewPatientForm2
>   Stop
>
>End Sub
>
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform