Hello,
Can Anybody tell me how to sum numbers in a column of a table,for e.g
2
4
3
8
9
10
Answer in another cell of the table should be 36. Thx..Harry:sign0085:
Well..I found the answer myself...Thanx Anyways..Cheers..
Sub Globals
'Declare the global variables here.
Dim x
Dim inx
End Sub
Sub App_Start
Form1.Show
Table1.Clear
table1.AddCol(cNumber, "men",20)
table1.AddCol(cNumber, "women",20)
table1.AddRow(10,20)
table1.AddRow(10,15)
table1.AddRow(15,7)
End Sub
Sub Button1_Click
For inx = 0 To Table1.RowCount - 1
x = x + Table1.Cell("men",inx)
Next
TextBox1.Text = x
End Sub
On pressing Button1,I do get the total of the column.
But on pressing it again,the column numbers once again get added to the existing total,which is wrong!
Can somebody tell me how to change the For Next statement to correct this..Thanx
Hmm, assuming that you have not turned off the warning of variables being used before being set, that may mean that the check misses that this is happening. After all, in the original version the first reference to the value of x takes place before the sum is assigned back to it, so the warning should have appeared...
hi mjcoon and agraham...yes...x is a global variable in my prog...if u see my 2nd post, i have declared it as a global var as under
Sub Globals
'Declare the global variables here.
Dim x
Dim inx
Yeah...x is not a little correct to use...i'm still learning prog..actually a commercial pilot by profession..i find basic4ppc very logical and a good way to start learning...and of course i'll pick up all the good things frm u guys...thx