Link to home
Start Free TrialLog in
Avatar of khalidsuhail
khalidsuhail

asked on

How do I multiply columns value in VSFlexgrid ?

Hi,
I'm using VSFlexgrid on my forms and I am using VB6 language. I want to multiply column 1 with column 2 and the result will be placed in third column like we do in price multiply by qty to get total amount and also I want to get all rows total in a text box outside the grid.
 thanks
Avatar of FER_G
FER_G
Flag of Argentina image

khalidsuhail; To get the result of multiply col1 * col2, you can do...
while you are populating the grid... you must get the total of the multiply operation of each row...
With VSFlexgrid1
   .TextMatrix(ActualRow, 1) = 2 'qty
   .TextMatrix(ActualRow, 2) = 1.25 'price
   .TextMatrix(ActualRow, 3) = val(.TextMatrix(.row, 1)) * val(.TextMatrix(.row, 2))
end with
...do this for each row that you add to the grid

then, you can obtain the total result of col3 with the Aggregate Property, like this...
With VSFlexgrid1
   txtTotal.text = .Aggregate(flexSTSum, .fixedRows, 3, .rows-1, 3)
end with

I hope the helps you.
Regards.
FerG.
Saludos
--
Ing. Fernando D. Giletta
San Fco. Cba. Argentina.
Avatar of khalidsuhail
khalidsuhail

ASKER

Thanks for your reply. But I dont want any constant values. What do you mean by ActualRow and 1
how would I know which row and which column my user in?
and where am I going to place these code? in what event VSFlesgrid???
 
ASKER CERTIFIED SOLUTION
Avatar of FER_G
FER_G
Flag of Argentina image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Is there any online documentation or help available for VSFlexgrid.
yes!, there is.
The help file is "vsflex8.chm". I don´t know if there's any online documentation, so, you've to google it....
but, could solve your problem with the code snippet?

FerG.
Saludos
--
Ing. Fernando D. Giletta
San Fco. Cba. Argentina.