Calculate the total of first column in datagrid

Page 1 of 1

1 Replies - 7349 Views - Last Post: 05 October 2012 - 09:38 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=294409&amp;s=1d15ab8fd1bf417765a61ac079077354&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

#1 raelkun00

• D.I.C Head

Reputation: 1
• Posts: 99
• Joined: 01-October 12

Calculate the total of first column in datagrid

Posted 05 October 2012 - 09:08 AM

```Private Sub Command1_Click()
Dim total1
For i = 0 To DataGrid1.ApproxCount - 1
DataGrid1.Col = 0
total1 = Val(total1) + Val(DataGrid1.Text)
Next
txtTotal.Text = total1
End Sub

```

It only displays the "value of first row* the number of record"
for example:
the first row is 3 and number of record is 15 it will display "15".
I need you help please. Thanks!

correction number of record is 5. Sorry.

Is This A Good Question/Topic? 0

Replies To: Calculate the total of first column in datagrid

#2 maj3091

• D.I.C Lover

Reputation: 316
• Posts: 1,882
• Joined: 26-March 09

Re: Calculate the total of first column in datagrid

Posted 05 October 2012 - 09:38 AM

I'm not that clued up in the datagrid, but I would suspect that you need to increment the row, if you want to sum up the column data, otherwise you'll always stay in the first row.
Was This Post Helpful? 0

Page 1 of 1

 .related ul { list-style-type: circle; font-size: 12px; font-weight: bold; } .related li { margin-bottom: 5px; background-position: left 7px !important; margin-left: -35px; } .related h2 { font-size: 18px; font-weight: bold; } .related a { color: blue; }