Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21273

msflexgrid not responding

$
0
0
Good day.

I have this sub that is suppose to help me on populating my msflexgrid.

I have tested this with the following records.

3 columns of 700 rows = populating ok
3 columns of 1000 rows = not responding for 10 secs.
3 columns of 1500 rows = not responding for 20 secs.

So the higher the records, it will definitely take time to load.

I have this code to populate my grid.

Code:

Private Sub refreshfg()
    Dim rs As New ADODB.Recordset
    Dim cn As New ADODB.Connection
   
    Dim con As New DLLConnectionFunction
    Set con = New DLLConnectionFunction
   
        If con.ConnectDBMySQLODBC("MySQL ODBC 5.2 ANSI Driver", cn, "localhost", "inventorydb", "sa", "12345") = True Then
       
        Dim fgg As DLLFlexGrid
        Set fgg = New DLLFlexGrid
       
        Dim strSQL As String
        strSQL = "select itemid,itemname,status from tbl_item1"
       
        If con.ConnectRS(cn, rs, strSQL, rsadOpenStatic, rsadLockPessimistic) = True Then
 
           
            If Not rs.EOF Then
                fgg.FG_ShowRecordset fg, rs, "ID,Name,Status", "1500,2000,2000", , , , , , , , 8
            Else
                fgg.FG_ShowRecordsetNoRecord fg, rs, "ID,Name,Status", "1500,2000,2000", , , , , , , , 8
            End If
           
           
        End If
    End If
        con.DisconnectRS rs
        con.DisconnectCN cn
End Sub

fg_showrecordset has this syntax:

Public Sub FG_ShowRecordset(myfg As MSFlexGrid, myrst As ADODB.Recordset, Optional sHeaders As String = "", Optional nHeadSize As String = "", Optional Rcolor As Integer = 192, Optional Gcolor As Integer = 255, Optional Bcolor As Integer = 192, Optional FntBold As Boolean = True, Optional FntColor As String = &H800000, Optional FntSize As Integer = 9, Optional cellfontname As String = "Arial", Optional cellfontsize As Long = 8)

Please help me optimize my code so that the populating of the flexgrid is fast.

Viewing all articles
Browse latest Browse all 21273

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>