1 Replies - 13033 Views - Last Post: 13 April 2009 - 11:41 PM Rate Topic: -----

#1 BoHead  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 12-April 09

VB.NET 2008 Sum of DataGridview Column

Posted 12 April 2009 - 03:40 PM

I am using VB.Net 2008 and have build a windows form with a datagridview that displays a query of records for the current client. One of the columns is for Fee. I need to total that column and place the result in a Label or Textbox.

I am using the Query builder to pull the records and so I can not get away with the SQL expression in the query returns the Schema does not match error.

I have tried to code it pulling the information directly into the form from the Datagridview and could not make that work either.


This should be easy, where am I missing it? Please, any help is appreciated.

Is This A Good Question/Topic? 0
  • +

Replies To: VB.NET 2008 Sum of DataGridview Column

#2 sakhr_99  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 42
  • Joined: 01-March 09

Re: VB.NET 2008 Sum of DataGridview Column

Posted 13 April 2009 - 11:41 PM

if you are using DataSet to pull the records then do this :

Dim TotalFee as double =0.0

For TotalRecords as integer to ds.tables(0).rows.count -1

TotalFee += cdble(de.tables(0).rows(TotalRecords).Item("FeeColumn"))

next

me.textbox.text = TotalFee



' More Over please paste the code you are using

This post has been edited by sakhr_99: 13 April 2009 - 11:42 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1