datagridview
-
how to perform calculations in datagridview columns (adding two columns and result in new column) can any one suggest me any site thanks in advance
Some of the gurus on here will probably have a better idea for this but this is what I would try:
Dim myCol As New DataGridViewColumn ' I think this is the type. My code was an image column myCol.Name = "colname" dgvMyGrid.Columns.Insert(1, myCol)
Then you'll need to access the values of the numbers you need to add and the column where the result should go. I do most of my processing in my OnCellFormatting event. And in there, I access the values of the current row's items with something like this:(sender.Rows(e.RowIndex).Cells(14).Value
Of course, you'll need to know your column's number. And don't forget to account for the one you entered. Hope this helps.Denise "Hypermommy" Duggan
-
how to perform calculations in datagridview columns (adding two columns and result in new column) can any one suggest me any site thanks in advance
If your
DataGridView
is bound to aDataTable
then this may be what you're looking for: http://msdn.microsoft.com/en-us/library/system.data.datacolumn.expression.aspx[^] I love these columns, they're smokin' fast :)