3 Replies - 2043 Views - Last Post: 11 June 2012 - 08:55 PM Rate Topic: -----

#1 01088  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 07-June 12

HOW TO SUM THE VALUES IN THE DATAGRIDVIEW....

Posted 11 June 2012 - 03:03 AM

Hi,

I want to sum the values in the columns of the datagridview when I click the button......in WIN FORMS...........HELP!!!
Is This A Good Question/Topic? 0
  • +

Replies To: HOW TO SUM THE VALUES IN THE DATAGRIDVIEW....

#2 John-Ellis  Icon User is offline

  • D.I.C Regular

Reputation: 7
  • View blog
  • Posts: 305
  • Joined: 23-March 10

Re: HOW TO SUM THE VALUES IN THE DATAGRIDVIEW....

Posted 11 June 2012 - 04:16 AM

View Post01088, on 11 June 2012 - 03:03 AM, said:

Hi,

I want to sum the values in the columns of the datagridview when I click the button......in WIN FORMS...........HELP!!!


How are you wanting the results be shown, are you wanting a message box to appear with the result or a label to be shown on the Form to show the result?

John
Was This Post Helpful? 0
  • +
  • -

#3 sela007  Icon User is offline

  • D.I.C Addict

Reputation: 137
  • View blog
  • Posts: 832
  • Joined: 21-December 11

Re: HOW TO SUM THE VALUES IN THE DATAGRIDVIEW....

Posted 11 June 2012 - 07:33 AM

use FOR/EACH loop:
pseudocode:
Dim ColSum As Integer
For Each R As DatagridViewRow In DataGridView1.Rows
ColSum+=R.Cells(X).Value
Next

Was This Post Helpful? 0
  • +
  • -

#4 01088  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 07-June 12

Re: HOW TO SUM THE VALUES IN THE DATAGRIDVIEW....

Posted 11 June 2012 - 08:55 PM

Hi,

When I click the button I want the result of the column added values to be displayed in the text box...
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1