12-02-20, 03:15 PM
(12-02-20, 02:24 PM)bassant كتب :(11-02-20, 06:27 PM)اسامه الهرماوي كتب : السلام عليكم...
ممكن الكود المستخدم لتصحيحة.
Dim xl As Integer
xl = DataGridView1.CurrentRow.Index
TextBox10.Text = CStr(DataGridView1.Rows(xl).Cells(0).Value)
TextBox17.Text = CStr(DataGridView1.Rows(xl).Cells(1).Value)
TextBox2.Text = CStr(DataGridView1.Rows(xl).Cells(2).Value)
DateTimePicker3.Text = DataGridView1.Rows(xl).Cells(3).Value
كود :
Private Sub DataGridView1_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
Dim r = DataGridView1.CurrentRow
If r IsNot Nothing Then
TextBox10.Text = CStr(r.Cells(0).Value)
TextBox17.Text = CStr(r.Cells(1).Value)
TextBox2.Text = CStr(r.Cells(2).Value)
If IsDate(r.Cells(3).Value.ToString) Then
DateTimePicker3.Value = CDate(r.Cells(3).Value.ToString)
End If
End If
End Sub