DataGridView Problem
-
Hi everyone, I've got a problem with my application and i need some help. I use a DataGridView to display the data.Data is being read from a db.I want to get the Sum of each cell under a column.For example: |Bills |Salary |PriceOfAPen ----------------------------------------------------- |500,00$ |300,00$ |50,00$ |400,00$ |300,00$ |50,00$ ----------------------------------------------------- Total: 900,00$ 600,00$ 100,00$ But my output looks like this: |Bills |Salary |PriceOfAPen ----------------------------------------------------- |500,00$ |300,00$ |50,00$ |400,00$ |300,00$ |50,00$ ----------------------------------------------------- Total: 1600,00$ Users can change or add tables so i have to do it when the data is called.Can someone please help me? Thanks already. Sorry for my English by the way as it is not my native language :)
-
Hi everyone, I've got a problem with my application and i need some help. I use a DataGridView to display the data.Data is being read from a db.I want to get the Sum of each cell under a column.For example: |Bills |Salary |PriceOfAPen ----------------------------------------------------- |500,00$ |300,00$ |50,00$ |400,00$ |300,00$ |50,00$ ----------------------------------------------------- Total: 900,00$ 600,00$ 100,00$ But my output looks like this: |Bills |Salary |PriceOfAPen ----------------------------------------------------- |500,00$ |300,00$ |50,00$ |400,00$ |300,00$ |50,00$ ----------------------------------------------------- Total: 1600,00$ Users can change or add tables so i have to do it when the data is called.Can someone please help me? Thanks already. Sorry for my English by the way as it is not my native language :)
Hi, You can use the RowCreated event to keep all the columns values in separate variables, and go on adding new values. then set these to the Footer labels. So simple.
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
-
Hi everyone, I've got a problem with my application and i need some help. I use a DataGridView to display the data.Data is being read from a db.I want to get the Sum of each cell under a column.For example: |Bills |Salary |PriceOfAPen ----------------------------------------------------- |500,00$ |300,00$ |50,00$ |400,00$ |300,00$ |50,00$ ----------------------------------------------------- Total: 900,00$ 600,00$ 100,00$ But my output looks like this: |Bills |Salary |PriceOfAPen ----------------------------------------------------- |500,00$ |300,00$ |50,00$ |400,00$ |300,00$ |50,00$ ----------------------------------------------------- Total: 1600,00$ Users can change or add tables so i have to do it when the data is called.Can someone please help me? Thanks already. Sorry for my English by the way as it is not my native language :)
You could use some variables for particular cell/row accordingly that maintains the total and at the end display the result accordingly.
Keshav Kamat :) India