Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reference object between forms

Status
Not open for further replies.

eseabrook2008

Technical User
Jan 9, 2008
74
CA
I'm very new to vb.net (last used vb6). My situation is that I have a form1 with a combobox (cb1). When a certain item is selected in the combobox, form2 opens.
Code:
'initial declaration
Dim FORMNAME
'inside combobox SelectIndexChanged event
FORMNAME = New contractequip
FORMNAME.ShowDialog(Me)
From form2, how do I reference form1 objects? In form2, if I select certain info, cb1 on form1 should change to a different value. As is stands now, on form2 I have added...
Code:
Public y As New form1
...which allows me to reference form1 objects but, I think, since I used "NEW" it passes objects with 'Nothing' values and when I try and set values on form1, it does keep the change once focus is passed back to form1. Ideas?
 
In Form2
Code:
Public y As Form1

In Form1
Code:
Dim FORMNAME As New Form2
FORMNAME.y = Me
FORMNAME.Showdialog
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top