08-04-18, 11:42 PM
عندما اقم بربط txtbox ب DB تضهر لي هده الرسالة
Index was out of range. Must be non-negative and less than the size of the collection.
هدا هو الكود:
Sub AtcherTxt()
Try
If Dgvfournisseurs.CurrentRow IsNot Nothing Then
Txtcod.Text = Dgvfournisseurs.CurrentRow.Cells(0).Value
Txtnom.Text = Dgvfournisseurs.CurrentRow.Cells(1).Value
Txcopa.Text = Dgvfournisseurs.CurrentRow.Cells(2).Value
Txtadresse.Text = Dgvfournisseurs.CurrentRow.Cells(3).Value
Txtaptente.Text = Dgvfournisseurs.CurrentRow.Cells(4).Value
Txtrecorde.Text = Dgvfournisseurs.CurrentRow.Cells(5).Value
Txttele1.Text = Dgvfournisseurs.CurrentRow.Cells(6).Value
Txttele2.Text = Dgvfournisseurs.CurrentRow.Cells(7).Value
Txtfax.Text = Dgvfournisseurs.CurrentRow.Cells(8).Value
Txtiail.Text = Dgvfournisseurs.CurrentRow.Cells(9).Value
Txtnot.Text = Dgvfournisseurs.CurrentRow.Cells(10).Value
End If
Catch ex As Exception
ارجو المساعدة وشكرا.
Index was out of range. Must be non-negative and less than the size of the collection.
هدا هو الكود:
Sub AtcherTxt()
Try
If Dgvfournisseurs.CurrentRow IsNot Nothing Then
Txtcod.Text = Dgvfournisseurs.CurrentRow.Cells(0).Value
Txtnom.Text = Dgvfournisseurs.CurrentRow.Cells(1).Value
Txcopa.Text = Dgvfournisseurs.CurrentRow.Cells(2).Value
Txtadresse.Text = Dgvfournisseurs.CurrentRow.Cells(3).Value
Txtaptente.Text = Dgvfournisseurs.CurrentRow.Cells(4).Value
Txtrecorde.Text = Dgvfournisseurs.CurrentRow.Cells(5).Value
Txttele1.Text = Dgvfournisseurs.CurrentRow.Cells(6).Value
Txttele2.Text = Dgvfournisseurs.CurrentRow.Cells(7).Value
Txtfax.Text = Dgvfournisseurs.CurrentRow.Cells(8).Value
Txtiail.Text = Dgvfournisseurs.CurrentRow.Cells(9).Value
Txtnot.Text = Dgvfournisseurs.CurrentRow.Cells(10).Value
End If
Catch ex As Exception
ارجو المساعدة وشكرا.