25-12-21, 01:00 PM
(آخر تعديل لهذه المشاركة : 25-12-21, 01:22 PM {2} بواسطة nouribenyahia.)
السلام عليكم جميعا من فضلكم أرجو المساعدة في تحويل هذا الكود من الداتا غريدفيو إلى الغريد كونترول التابع للديف إكسبرس
جزاكم الله خيرا
For M As Integer = 0 To DataGridView1.Rows.Count - 1
DataGridView1.Rows(M).Cells(10).Value = Date.Now
Next
If textBcode.Text <> Nothing Then
Dim DT As New DataTable
Dim DA As New SqlClient.SqlDataAdapter("SELECT * FROM ITEMS WHERE ITEM_BARE LIKE '" & textBcode.Text & "'", sqlConn)
DA.Fill(DT)
If DT.Rows.Count > 0 Then
'______________________التحقق من كود الصنف
For I = 0 To DataGridView1.Rows.Count - 1
If DataGridView1.Rows(I).Cells(0).Value = DT.Rows(0).Item("ITEM_CODE") Then
DataGridView1.Rows(I).Cells(4).Value = Val(DataGridView1.Rows(I).Cells(4).Value) + 1
textBcode.Clear()
Exit Sub
End If
Next
'______________________إضافة سجل للداتا قريد
Dim BAR As Integer
DataGridView1.Rows.Add()
BAR = DataGridView1.Rows.Count - 1
DataGridView1(0, BAR).Value = DT.Rows(0).Item("ITEM_CODE")
DataGridView1(1, BAR).Value = DT.Rows(0).Item("ITEM_NAME")
DataGridView1(2, BAR).Value = DT.Rows(0).Item("ITEM_UNITE")
DataGridView1(4, BAR).Value = 1
DataGridView1(4, BAR).Selected = True
Else
End If
End If