Solved

MSFlexGrid and encapsulated RDO

Posted on 2001-06-26
3
313 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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

810 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