If itemname.Text = Me.DataGridView1.Rows(0).Cells(0).Value Then Me.DataGridView1.Rows(0).Cells(1).Value = CDbl(Me.DataGridView1.Rows(0).Cells(1).Value) - CDbl(quantity.Text) MsgBox("Data Saved SuccessFully") quantity.Text = "" itemname.Text = "" ElseIf itemname.text = Me.DataGridView1.Rows(1).Cells(0).Value Then Me.DataGridView1.Rows(1).Cells(1).Value = CDbl(quantity.Text) - CDbl(Me.DataGridView1.Rows(1).Cells(1).Value) MsgBox("Data Saved SuccessFully") quantity = "" itemname.Text = "" ElseIf itemname.Text = Me.DataGridView1.Rows(2).Cells(0).Value Then Me.DataGridView1.Rows(2).Cells(1).Value = CDbl(quantity.Text) - CDbl(Me.DataGridView1.Rows(2).Cells(1).Value) MsgBox("Data Saved SuccessFully") quantity = "" itemname.Text = "" ElseIf itemname.Text = Me.DataGridView1.Rows(3).Cells(0).Value Then Me.DataGridView1.Rows(3).Cells(1).Value = CDbl(quantity.Text) - CDbl(Me.DataGridView1.Rows(3).Cells(1).Value) MsgBox("Data Saved SuccessFully") quantity.Text = "" itemname.Text = "" endif end sub And So on....... PLEASE HELP ....
For Each row As DataRow In Me.DataGridView1.Rows If itemname.Text = row.Cells(0).Value Then row.Cells(1).Value = Convert.ToDouble(row.Cells(1).Value) - Convert.ToDouble(quantity.Text) Interaction.MsgBox("Data Saved SuccessFully") quantity.Text = "" itemname.Text = "" Exit For End If Next
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)