VB.NET: Adding Items to ComboBox from previous form

toytoy

Well-known member
Joined
Jul 16, 2004
Messages
46
Programming Experience
1-3
Say i have Form1 with comboBox1 and Form2 with comboBox2..

When i click on Form1 button, Form2 will appear on top of Form1...

My Code:


VB.NET:
' Form1 button 
 Private Sub btnOne_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOne.Click
		Dim form2 As New Form2
		form2.ShowDialog()
	End Sub


How to add the items from Form2 's comboBox to Form1 's comboBox...

My Code:
VB.NET:
' Form2 button 
  Private Sub btnTwo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTwo.Click
	   Dim form1 As New Form1
	   form1.comboBox1.Items.Add(Me.comboBox2.Text)
	End Sub


These code will not have any effect on comboBox1 in Form1..

Thanks
 
Back
Top