VB6 multiple selections from msflexgrid to array with checks
Posted on 2007-03-29
Our inhouse software covers invoice registration amongst other things. (Visual Basic 6)
Operational people enter their expected costs on a per file basis.
When the actual invoice arrives, the finance department registers the invoice in their part of the system, then matches the "expected costs" entered by the operational people to the actual invoice.
At the moment the finance users can only select one line at a time and the confirm.
I would like them to be able to match multiple lines in one go.
The selections are made from a msflexgrid.
To start with I created:
Private Type RowsToValidate
DetID as long ' ID of the expected costs table
RegNr as long ' The invoice registration number
FlexRowNr as Byte ' Flex line nr ' Don't know if this is even necessary
Dim ValRows() as RowsToValidate 'Rows to confirm
When the user clicks on the flex to make the selection I would like:
A check to see if it has already been selected. If so remove it from the array (Deselect)
If it hasn't been selected I want to add it to the array.
Once the user has made all the selections they want, they will click on a button to do the confirmation (Validation)
This will be done by a function. For this to work i'll need to know how many values are in the array.
Can I use something like:
FOR i = 0 to max(Array) ????
or should I use the recordset count from the rs used to fill the flex in the first place???
As this is the first time I have worked with types, arrays and multiple selections on flexgrids, I am having a trouble getting my head around the logic needed and the steps involved.
Thanks in advance for any help you can offer.