13-10-22, 07:42 PM
(13-10-22, 07:20 PM)Taha Okla كتب : ممكن ترفق الكود الذي يدخل البيانات في الداتا جريد
حتى نقف على المشكلة وم ثم نحدد الكائن المسؤول عن إدخال البيانات عليه.
المعنى :
أن تقوم بإدخال البيانات على الكائن المسؤول عن الداتا جريد وليس الداتا نفسها..
لأن الداتا صورة عن الكائن(وتابع له في كل ما يكون عليه) لا أكثر..
كود :
'============ ادراج الاصناف المتعددة في شاشة المشتريات =================
If DataGridView1(0, DataGridView1.CurrentRow.Index).Selected = True Then
For I = 0 To BUYBILL.DataGridView1.Rows.Count - 1
If BUYBILL.DataGridView1.Rows(I).Cells(0).Value = DataGridView1.CurrentRow.Cells(1).Value Then
BUYBILL.DataGridView1.Rows(I).Cells(4).Value += 1
' MessageBox.Show("تم إدراج الصناف مسبقا", "رسالة تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Error)
BUYBILL.CALC()
Exit Sub
End If
Next
Dim CODE_ As Integer
CODE_ = BUYBILL.DataGridView1.Rows.Count - 1
'==== الاضافة =====
BUYBILL.DataGridView1.Rows.Add()
BUYBILL.DataGridView1.Rows(BUYBILL.DataGridView1.Rows.Count - 1).Cells(0).Value = DataGridView1.CurrentRow.Cells(1).Value
BUYBILL.DataGridView1.Rows(BUYBILL.DataGridView1.Rows.Count - 1).Cells(1).Value = DataGridView1.CurrentRow.Cells(2).Value
BUYBILL.DataGridView1.Rows(BUYBILL.DataGridView1.Rows.Count - 1).Cells(2).Value = DataGridView1.CurrentRow.Cells(4).Value
BUYBILL.DataGridView1.Rows(BUYBILL.DataGridView1.Rows.Count - 1).Cells(3).Value = DataGridView1.CurrentRow.Cells(5).Value
BUYBILL.DataGridView1.Rows(BUYBILL.DataGridView1.Rows.Count - 1).Cells(7).Value = DataGridView1.CurrentRow.Cells(6).Value
BUYBILL.DataGridView1.Rows(BUYBILL.DataGridView1.Rows.Count - 1).Cells(4).Value = 1
BUYBILL.CALC()
End If