mshflexgrid control, programmatically adding data
Posted on 1999-07-28
I would like to programatically add data to a mshflexgrid
control. I cannot bind the control to my data, because the
data is in a format that will not support binding to the
control. I have two problems.
First, when I loop through my data structure, assigning
the values to the grid, the first row in my grid
appears empty (the first row below what appears to be
the field name area ... so two rows, really).
Second, I would like to be able to assign field names. I
don't see properties to do that. Is that only available if
my control is bound?
Here is some code from my procedure:
("theline" is a record from the source data structure)
If theline Is Nothing Then
' do nothing
' populate a string
For thecount = 0 To thefields.FieldCount - 1
thetabbedline = thetabbedline & vbTab & theline.Value(thecount)
If thetabbedline <> "" Then
' add string to grid
thetabbedline = ""
Set theline = thecursor.NextRow
Loop Until theline Is Nothing
It occurs to me that there may be controls better
suited to my goal. What I need to do is put records
into a grid, be able to identify what rows/columns/
cells are selected by the user, do some sorting,
do some aggregation (sum,mean,etc), export selected
or aggregated records (the least important piece).
If you think that there is another control, that ships
with VB6, Windows NT, or MSOffice2000, that will
better suit my needs, please let me know.
Thanks for your help.