how to calculate subtotals per line, in a datagrid?

fscsantos

Member
Joined
Aug 2, 2005
Messages
15
Programming Experience
Beginner
Hi everybody,

i'm new in VB.net. I'm working on a project with datagrids.

I've 4 columns into the datagrid, they are product name, price, quantity and totalcost. My problem is how can i update automatically for example column totalcost after inserting values in price and quantity text boxes ().
I want when inserting a value in the column of the quantity, update the subtotal of the line


If anyone can help me please give suggestion.

Thanks.
 
Schenz,

thank´s for the links that you advised but unfortunately i'm working with windows data grids not with asp grids i forgotten to mention in the post.

if you have any suggestion to windows forms i'd be very thankful.
 
Ok, it seems that the Windows Forms version of the control does not have an ItemDataBound Event, so let's get some more info on what you want to do.

Do you pull the data from a database?

Is there really a need for a totalcost column? (This is just a calculation.....)

My guess is that we just need to figure out how to Qet the values from the Quantity and Price Columns (especially if we just edited them) and perform the caluclation ourselves and apply that calculation to the TotalCost Column.

I have personally only used the Windows DataGrid to display information (or allow a user to select what item they want to edit - which then either opens in a lower part of the form, or another form) so I am unsure as to how to interact with it directly like this.
 
Ok, let's explain better what i really want.

I'm pulling the data from a database. And i really need to have a column to display the total of each column.

The problem is a invoice lines tipically problem.
 
Back
Top