Solved

MSFlexGrid and encapsulated RDO

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

920 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

15 Experts available now in Live!

Get 1:1 Help Now