How to Populate Textbox value to Textbox from unrelated table in VB.net ?
TextboxA and TextboxB are Windows Form TextBox objects placed on the form. Assume that tblWorkorder and tblChecklists are each a DataTable object that are assigned to the DataSet that hold the data from the database.
Because the two TextBox’s are on two different forms we need to save a reference to the second form so that when you want access to the form2 controls you use its reference and the control and property you want as shown below.
Public Class frmExample1 '' Create a form level variable which make it available to all code in this Form Dim frm2 As frmExample2 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click '' Create the frmExample2 form and assign it to the class level variable and show the form frm2 = New Form2() frm2.Show() '' Now when you want to assign the value of TextBoxA to TextBoxB '' you can do this. frm2.TextBoxB.Text = TextBoxA.Text End Sub End Class