07-03-22, 10:45 PM
السلام عليكم هل هناك طريقه لنقصان عدد في خانه معينه datagridview توجد في form1
من عدد في في خانه معينه datagridview توجد في form2
علما ان قاعدة البيانات ربطتها بهدا الشكل
(08-03-22, 12:30 PM)جيولوجي مبتدئ كتب : [ -> ]السلام عليكم ورحمة الله وبركاته
عفواً أخي سؤال غير واضح لكن الذي فهمته أنك تريد إنقاص أو زيادة قيمة خلية في الداتاقريدفيو بقيمة +1 أو -1
في حالة +1
1+( datagridview1.rows(i).cells(2).tostring= val( datagridview1.rows(i).cells(2).tostring
في حالة -1
1-( datagridview1.rows(i).cells(2).tostring= val( datagridview1.rows(i).cells(2).tostring
أتمنى أن يكون هذا المطلوب
دمتم بود
لكم جزيل الشكر
Dim poss As Integer = DataGridView2.CurrentRow.Index
Dim posNN = DataGridView2.Rows(poss).Cells(0).Value
Dim posPP = DataGridView2.Rows(poss).Cells(3).Value
Dim xx1,xx2 as string
Try
For i = 0 To DataGridView1.Rows.Count - 1
Dim x(DataGridView1.ColumnCount) As String
For ii = 0 To DataGridView1.ColumnCount
Try
x(ii) = DataGridView1.Rows(i).Cells(ii).Value.ToString
Application.DoEvents()
Catch
End Try
Next
Application.DoEvents()
If x(0) = posNN Then
xx1 = x(6)
End If
Next
Catch ex As Exception
End Try
xx2 = val(posPP) - val(xx1)(08-03-22, 06:38 PM)SaedAmer كتب : [ -> ]كود :
Dim poss As Integer = DataGridView2.CurrentRow.Index
Dim posNN = DataGridView2.Rows(poss).Cells(0).Value
Dim posPP = DataGridView2.Rows(poss).Cells(3).Value
Dim xx1,xx2 as string
Try
For i = 0 To DataGridView1.Rows.Count - 1
Dim x(DataGridView1.ColumnCount) As String
For ii = 0 To DataGridView1.ColumnCount
Try
x(ii) = DataGridView1.Rows(i).Cells(ii).Value.ToString
Application.DoEvents()
Catch
End Try
Next
Application.DoEvents()
If x(0) = posNN Then
xx1 = x(6)
End If
Next
Catch ex As Exception
End Try
xx2 = val(posPP) - val(xx1)
(08-03-22, 07:10 PM)hafid33 كتب : [ -> ](08-03-22, 06:38 PM)SaedAmer كتب : [ -> ]كود :
Dim poss As Integer = DataGridView2.CurrentRow.Index
Dim posNN = DataGridView2.Rows(poss).Cells(0).Value
Dim posPP = DataGridView2.Rows(poss).Cells(3).Value
Dim xx1,xx2 as string
Try
For i = 0 To DataGridView1.Rows.Count - 1
Dim x(DataGridView1.ColumnCount) As String
For ii = 0 To DataGridView1.ColumnCount
Try
x(ii) = DataGridView1.Rows(i).Cells(ii).Value.ToString
Application.DoEvents()
Catch
End Try
Next
Application.DoEvents()
If x(0) = posNN Then
xx1 = x(6)
End If
Next
Catch ex As Exception
End Try
xx2 = val(posPP) - val(xx1)
اخي اين اضع هدا الكود هل في الفورم الاول او الثاني واين بالضبط هل في حدث الform3_load
وهل تتم العميل لوحده يعني اول ما اشغل العمل تتم العمليه !!!
(08-03-22, 07:16 PM)SaedAmer كتب : [ -> ](08-03-22, 07:10 PM)hafid33 كتب : [ -> ](08-03-22, 06:38 PM)SaedAmer كتب : [ -> ]كود :
Dim poss As Integer = DataGridView2.CurrentRow.Index
Dim posNN = DataGridView2.Rows(poss).Cells(0).Value
Dim posPP = DataGridView2.Rows(poss).Cells(3).Value
Dim xx1,xx2 as string
Try
For i = 0 To DataGridView1.Rows.Count - 1
Dim x(DataGridView1.ColumnCount) As String
For ii = 0 To DataGridView1.ColumnCount
Try
x(ii) = DataGridView1.Rows(i).Cells(ii).Value.ToString
Application.DoEvents()
Catch
End Try
Next
Application.DoEvents()
If x(0) = posNN Then
xx1 = x(6)
End If
Next
Catch ex As Exception
End Try
xx2 = val(posPP) - val(xx1)
اخي اين اضع هدا الكود هل في الفورم الاول او الثاني واين بالضبط هل في حدث الform3_load
وهل تتم العميل لوحده يعني اول ما اشغل العمل تتم العمليه !!!
هذا الكود عبارة عن جلب قيمة الصابون من form 2 و جلب قيمة prix_vente عن طريق رمز الكود و num pro و طرحهم من بعض
هذا الكود يتم وضعه في button او datagrid button في form 2