19-05-24, 01:17 AM
مرحبا بك أخي moh61
تفضل هذا الكود يقوم بالمطلوب الذي أردته بالضبط !
بالتوفيق إن شاء الله .
تفضل هذا الكود يقوم بالمطلوب الذي أردته بالضبط !
بالتوفيق إن شاء الله .
كود :
Dim found As Boolean = False
For Each row As DataGridViewRow In DataGridView1.Rows
If row.Cells(0).Value = TextBox1.Text And row.Cells(1).Value = TextBox2.Text Then
row.Cells(2).Value = Val(row.Cells(2).Value) + Val(TextBox3.Text)
row.Cells(3).Value = Val(row.Cells(1).Value) * Val(row.Cells(2).Value)
found = True
Exit For
End If
Next
If Not found Then
Dim newRow As String() = {TextBox1.Text, TextBox2.Text, TextBox3.Text, Val(TextBox2.Text) * Val(TextBox3.Text)}
DataGridView1.Rows.Add(newRow)
End If

