RE:Pasar datos de formulario a formulario
Publicado por
MOHAMED NABE (1 intervención) el 22/07/2021 23:49:54
HOLA BUENAS TARDES.
Como puedo pasar datos entre 3 formularios.
En en 1er formulario tenemos una caja de texto donde tengo variable Expediente(txtExpediente), en el 2do formulario tengo 4 cajas de texto que son respectivamente NOMBRE(txtnombre), Primer_Apellido(txtTexbox1), Segundo_Apellido(txtTexbox2) , Fecha_de_Nacimiento(TxtTexbox3) los cuales debo pasar en el 3er formulario (DataGridView1) haciendo clic en un boton del formulario 2.
Trate de hacer sin hacer uso de la base de datos no me sale y este ultimo codigo estoy implicando la base de datos pero taampoco me sale.
Estoy trabajando en visual Basic.Net 2013.Agradezco de ante mano sus ayudas
Adjunto mi formulario.
Dim con As New SqlConnection("Data Source=desktop-aa5vg4v;Initial Catalog=nuevaBD;Integrated Security=True")
Dim Sql As String = "SELECT * from Expediente"
Dim cmd As New SqlCommand(Sql, con)
Dim da As New SqlDataAdapter(cmd)
Dim dt As New DataTable
da.Fill(dt)
Try
Dim form As New Form3
Dim dtg As New DataGridView1
Dim exp As Expediente
form.ShowDialog()
TxtExpediente.Text = dtg.DataGridView1.CurrentColumns.Cells(0).Value.ToString
TxtNBRE.Text = dtg.DataGridView1.CurrentColumns.Cells(1).Value.ToString
TextBox2.Text = dtg.DataGridView1.CurrentColums.Cells(2).Value.ToString
TextBox3.Text = dtg.DataGridView1.CurrentColumns.Cells(4).Value.ToString
TextBox3.Text = dtg.DataGridView1.CurrentColumns.Cells(5).Value.ToString
Catch ex As Exception
MsgBox ("Not existen Parametros",MsgBoxStyle.Information,"INFORMACION" )
MOHAMED NABE,MEXICO