Question Transfer Data from DataGridView to TextBox in another MDI Child Form


New member
Mar 15, 2020
Programming Experience
Visual Basic .NET 2019 - I have two forms, an MDI Child (Register of Users) which in turn calls another MDI Child (Search Users),
in this second form I do some searches and display it in a DataGridView, when I try to pass the data inside the DataGridView
when I do a Double Click on this Grid I would like to pass this data to the MDI Child form that calls the MDI GrandChild form
and I can't, see the code (it is not working as i expected):

Private Sub dgvUsuarios_DoubleClick(sender As Object, e As EventArgs) Handles dgvUsuarios.DoubleClick

' frmCadastroUsuarios is the MDI Child that calls frmConsultaUsuarios (MDI GrandChild)

frmCadastroUsuarios.txtChave.Text = dgvUsuarios.CurrentRow.Cells(0).Value
frmCadastroUsuarios.txtUsuario.Text = dgvUsuarios.CurrentRow.Cells(1).Value
frmCadastroUsuarios.txtSenha.Text = dgvUsuarios.CurrentRow.Cells(2).Value
frmCadastroUsuarios.cboPermissao.Text = dgvUsuarios.CurrentRow.Cells(3).Value
frmCadastroUsuarios.mskDataCad.Text = dgvUsuarios.CurrentRow.Cells(4).Value
End Sub

Here is the source code of the query button of the child form calling the MDI GrandChild form

Private Sub cmdConsultar_Click(sender As Object, e As EventArgs) Handles cmdConsultar.Click
Dim frmNeto As New frmConsultaUsuarios()
frmNeto.MdiParent = Me.MdiParent
frmNeto.Show() ' frmNeto is the MDI GrandChild form
End Sub

Could someone please help me on how to transfer the data to the controls on the another form?

Top Bottom