Solved

MSFlexGrid and encapsulated RDO

Posted on 2001-06-26
3
311 Views
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
        Else
            Grid.TextMatrix(Y, 4) = CStr & _(.ciResultPropLocNumber) & " " & .ciResultPropLocName
        End If
        Y = Y + 1
        .ciMoveNext
        DoEvents
    Loop
    .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.
0
Comment
Question by:VBDemiurge
  • 2
3 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 150 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.
0
 

Author Comment

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

Author Comment

by:VBDemiurge
ID: 6229025
TimCoffee:

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.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

705 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now