MSFlexGrid and encapsulated RDO

Posted on 2001-06-26
Medium Priority
Last Modified: 2013-11-25
To display a predefined set of columns from an SQL Server 7.0 table I am a MSFlexGrid control using a class module encapsulating an RDO resultset. I populate the resultset using a stored procedure, and expose the individual RDOResultset::RDOColumns in read-only String properties,  the RDOResultset::EOF property in a public Boolean property.

I use the following routine to populate the grid:

Dim Y As Long
Dim X As Integer
Dim Deleted As Boolean

Grid.Rows = Grid.FixedRows
Y = Grid.Rows
'XInquiry is set to one of 5 instances of Cinquiry
With XInquiry    
    Do Until .ciEOF = True
        If blnInterrupt = True Then
            Exit Sub
        End If
        Grid.Rows = Y + 1
        Grid.Row = Y
        Grid.TextMatrix(Y, 0) = .ciResultDeleted
        Select Case Trim(Grid.TextMatrix(Y, 0))
            Case "A"
                Deleted = False
            Case "T"
                Deleted = True
            Case "N"
                Deleted = False
            Case "Y"
                Deleted = True
        End Select
        If Deleted = True Then
            For X = 0 To (Grid.Cols - 1)
                Grid.Col = X
                Grid.CellBackColor = vbCyan
            Next X
        End If
        Grid.TextMatrix(Y, 1) = CStr(.ciResultType)
        Grid.TextMatrix(Y, 2) = .ciResultUID
        Grid.TextMatrix(Y, 3) = .ciResultName
        If .ciResultPropLocNumber = 0 Then
            Grid.TextMatrix(Y, 4) = .ciResultPropLocName
            Grid.TextMatrix(Y, 4) = CStr & _(.ciResultPropLocNumber) & " " & .ciResultPropLocName
        End If
        Y = Y + 1
    .ciFlushResultset 'deallocate the RDO resultset
End With

While using small resultsets (1-500 rows), this code performs well, but I typically handle resultsets of 2500-15000 rows, and would like to make the MSFlexGrid populate faster, as my debugging traces have led me to the conclusion that the MSFlexGrid population code is the bottleneck.
Question by:VBDemiurge
  • 2
LVL 43

Accepted Solution

TimCottee earned 600 total points
ID: 6227646
One way to make things quicker is to set the MSFlexgrid.Redraw property to false at the beginning and then True at the end. This has the effect of disabling the update of the grid for each individual change, where you are setting cell colours, this may make a dramatic increase in the rate at which the grid is populated.

Author Comment

ID: 6228905
Thanks for the suggestion, TimCoffee. I'll try that now.

Author Comment

ID: 6229025

Working the MSFlexGrid::Redraw property reduced the load time for 15000 rows from 75-90 seconds to 30-45 seconds. My goal is to reduce the load time to a maximum of 20 seconds for 15000 rows.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

587 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question