Home > Back-end >  Auto add columns value to a textbox without click a button
Auto add columns value to a textbox without click a button

Time:12-12

Datagridview table example:

ItemName      ItemPrice
Candy         20
Candy2        10

textbox1 30

ItemName      ItemPrice
Candy2        10

textbox1 10

What I wanted to say is that whenever I add a row into the table it automatically calculate the item price in a textbox. So if I add another item into the datagrid it will update automatically with the total sum of the itemprice column from the datagrid table. Also when I delete a row it also decrease the sum ,without pressing any button.

CodePudding user response:

CellValueChanged reacts after a change, there yoou can add arithmetic operations.

CodePudding user response:

It was "rowsAdded" event on Datagridview. when a new row is added to the datagrid it automatically put the price in the textbox as well as adding another row, it will show the total sum of how many rows are added.

  • Related