I'm having trouble passing variables between Forms. Let me explian my self by an example.
I have a Form1, the user types a "Client ID" in a textbox if it's not a valid one, it opens a Form2 in which the user selects the correct "Client ID", once selected he presses an OK button.
And there comes the porblem.. it opens a new Form1 with the Client ID that he selected from Form2, but I still have the first Form1 opened.
I have two Form1 opened...
I which to keep the original Form1, but with the value sent from Form2..
I'm using this code:
Code in Form1
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim obj As New Form2 obj.passedtext = TextBox1.Text obj.Show() End Sub
Code in Form2
Public Class Form2 Private _passedtext As String Public Property [PassedText]() As String Get Return _passedText End Get Set(ByVal Value As String) _passedText = Value End Set End Property Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Label1.Text = _passedtext End Sub