I\'m making a program that generates SQL Server code to use it in my VB.NET program.
I have this first form that contains the connection like you see in picture belo
The simplest way to pass a value from one form to another is to implement the New
method on the form you want to pass the value to:
Form1
:
Public Class Form1
Private Sub btnPass_Click(sender As Object, e As EventArgs) Handles btnPass.Click
Dim form As New Form2(TextBox1.Text)
form.Show()
End Sub
End Class
Form2
:
Public Class Form2
Public Sub New(ByVal value As String)
' This call is required by the designer.
InitializeComponent()
Label1.Text = value
End Sub
End Class
Screenshot: