Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

sum of a column data in MSHFlexGrid

Dear Forum Members,

I am using MSHFlexGrid in my VB6.0 application to display a cash counter data like invoice no, date, items, quantity and amount. I want to get the total sum of quantity and amount column from MSHFlexGrid. Is there any way to apply a formula to a single column in MSHFlexGrid like in Excel column? How to get the total of quantity and amount column from MSHFlexGrid??

Thanks in advance.
[423 byte] By [ssk2k4] at [2007-11-11 8:37:39]
# 1 Re: sum of a column data in MSHFlexGrid
The following is a way to get a summary on a column :

Dim MTotal as Double
Dim MInt as Integer
Dim MAmount as Double

For MInt = 1 To MSHFlexGrid1.Rows - 1
MAmount = 0#
MSHFlexGrid1.Row = MInt
MSHFlexGrid1.Col = 5
If IsNumeric(MSHFlexGrid1.Text) = True Then
MAmount = CDbl(MSHFlexGrid1.Text)
End If
MTotal = MTotal + MAmount
Next MInt

txtTotal.Text = Format(MTotal, Mask2)
jggtz at 2007-11-11 17:25:15 >