Jassimi
asked on
adjust the texbox total value
hi..
I have an editable datagrid that contains on 3 columns (unit_price, qty, price),
and I have one textbox (txtTOTAL) to count all rows of the price column,
what I want is when the user edit the value of any price cell in the datagrid, the (txtTOTAL) will adjust depends on the changes.
thanks
I have an editable datagrid that contains on 3 columns (unit_price, qty, price),
and I have one textbox (txtTOTAL) to count all rows of the price column,
what I want is when the user edit the value of any price cell in the datagrid, the (txtTOTAL) will adjust depends on the changes.
thanks
ASKER
cdally33,
when I put your code I'm getting this error:
Conversion from String "" to type 'Double' is not valid. Source: Microsoft.VisualVasic
sounds like your cell value doesn't have a value at that point. to get around that you can do something like this:
Private Sub DataGridView1_CellValueChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellValueChanged
Dim row As DataGridViewRow = DataGridView1.Rows(e.RowIndex)
Dim cell As DataGridViewCell = row.Cells(e.ColumnIndex)
Dim mynewvalue = cell.Value
if isnumeric(mynewvalue) then
txtbox.text = txtbox.text + mynewvalue
end if
End Sub
ASKER
what do you mean by (e.RowIndex)
e.RowIndex is the 0-based index number of row being edited
here you'd be using it to retrieve the row containing the edited cell
here you'd be using it to retrieve the row containing the edited cell
ASKER
I still facing same error,
the other thing is that I don't want number of row to be fixed..
because sometime when I make search in the datagrid, the rows required will appear and after that I will edit the values
I'm confused then about what your end result needs to be. Sorry.
ASKER
any body can help ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window