Mysql
 sql >> Database >  >> RDS >> Mysql

Come ottenere i valori di riga di un datagridview e passarlo a un altro modulo utilizzando un pulsante nella stessa riga

Per fare ciò puoi utilizzare il CellClick evento del tuo DataGridView , vedi sotto.

  Private Sub grdApplicantsAS_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles grdApplicantsAS.CellClick
        Dim frm2 As Form2
        Try
            'First column button
            If e.ColumnIndex = 0 Then
               frm2 = New Form2(grdApplicantsAS.CurrentRow.Cells(YOUR NUMBER COLUMN).Value.ToString())
               frm2.ShowDialog()
            ElseIf e.ColumnIndex = 1
               'Do what you need here for the other button...
            End If             

        Catch ex As Exception
        End Try
    End If
End Sub

ESEMPIO DEL MODULO 2

 Public Class Form2
   Public Property EmployeeName As String

   'Pass your name in as the argument. Now Form 2 will have your name...
   Public Sub New(ByVal strEmployeeName As String)

     'Set your property of your employee name
     EmployeeName = strEmployeeName

   End Sub

 End Class