Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
pnlMain.Controls.Clear()
Dim objForm2 As New Form2()
objForm2.Size = pnlMain.Size
objForm2.TopLevel = False
objForm2.Parent = pnlMain
objForm2.Show()
End Sub
Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
If e.RowIndex = -1 Then Exit Sub
With DataGridView1
Form2.TextBox1.Text = .Rows.Item(e.RowIndex).Cells(0).Value.ToString()
End With
Me.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Form1.pnlMain.Controls.Item("Form2").Controls("textbox1").Text = "ทดสอบโดยฟอร์ม3"
End Sub
Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
If e.RowIndex = -1 Then Exit Sub
With DataGridView1
Form1.pnlMain.Controls.Item("Form2").Controls("textbox1").Text = .Rows.Item(e.RowIndex).Cells(0).Value.ToString()
End With
Me.Close()
End Sub