Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 505
  • Last Modified:

Inserting data into a Flex Grid

Hi i am using an ADO recordset to get my data from the database, but now i would like to list all the data ina flex grid

Im not sure on what sort of loop to use to ensure it all gets in there

string = "" & vbTab & field1 & vbTab & field2 & vbTab & field3 & vbTab & field4
flex_grid.AddItem string

How should i go about looping the above code

Thanks in advance for your help
0
Matthew Tandy
Asked:
Matthew Tandy
1 Solution
 
rinksno1Commented:
'HERE IS THE CODE FIRSTLY THE CHECK IS BEING MADE TO FIND 'OUT WHETHER THE RECRDSET IS EMPTY IF IT IS NOT EMPTY THEN
'REMOVE THE EXISTING ROWS AND THEN INSERT THE ROWS FROM THE 'db ONE BY ONE
'===================================================
    Dim intRowCount As integer

    If rs.EOF And rs.BOF Then Exit Sub
    intRowCount = 1
    MSFgrid.FixedRows = 0

    'REMOVES THE EXISTING ROWS
    For intRowCount = 1 To MSFgrid.Rows - 1
        MSFgrid.RemoveItem 1
    Next intRowCount
       
    While Not rs.EOF
        string = "" & vbTab & field1 & vbTab & field2 & vbTab & field3 & vbTab & field4

       flex_grid.AddItem string
       rs.MoveNext

    Wend

    If MSFgrid.Rows > 1 Then MSFgrid.FixedRows = 1
'====================================================
'RINKS
0
 
supunrCommented:
why not use a MSHFlexGrid control ("Microsoft Hierachical FlexGrid Control"  and set the datasource.

ie.
Set MSHFlexGrid1.DataSource = rsRecordSet

might even work for FlexGrid itself.  try it...
Set MSFlexGrid1.DataSource = rsRecordSet

then you hide the columns you don't want.
ie.
MSFlexGrid1.ColWidth(2) = 0 ' etc.

Good Luck!
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now