Hi all,
I have a problem where I have a DataGridView with invoice information. One of the columns is the price of a service.
Right below this I have a label that needs to show the total value of this invoice, and it needs to be shown as the user types the values.
e.g.
Service | Value
Hotel | $200.00
Total: $200.00
After typing the next entry...
Service | Value
Hotel | $200.00
Taxi | $50.00
Total: $250.00
Also, I don't know how to use events. So, if you can explain me how to declare an event...
I know I must use method for this (e.g. private void dgrid_CellValueChanged(object sender, DataGridViewCellEventArgs e){ ... } ), but I don't know how to make this method to be called when there is a cell updating, in fact.
After this, when I try to use the solution proposed for Pawan, I got the following error:
"Object reference not set to an instance of an object."
On the line:
double V = string.IsNullOrEmpty(dgrid.Rows[i].Cells["Service"].Value.ToString()) ? 0 :Convert.ToDouble(dgrid.Rows[i].Cells["Service"].Value);
PS: I set this column as typeof(double) in the Form Load event and I am also using a column format as C2(currency). In this case, after entering the value, it puts the symbol $ in front of the value. Also, when I type something in one of the columns, a new line is automatically created.
Can someone help me? :confused:
Thanks in advance! ;)