Hi,

I am trying to get Data from a MapPoint Recordset and insert them into a Listview control using a MoveNext loop but it is taking ages to finish (with only 157 records)! The performance is really poor...

Is there any better way to get Data from a Recordset object improving performance?

Please tell me there is...

tia
Nikos


Code:
Public Sub refreshListView(oRS As MapPoint.Recordset)
    On Error GoTo Errhandler:
    Dim oItem As MSComctlLib.ListItem
    Dim oFields As MapPoint.Fields
    Dim i As Integer
    Dim tempValue As String
    
    Set oFields = oRS.Fields
    lstDataGrid.ColumnHeaders.Clear
    i = 1
    For i = 1 To oRS.Fields.Count
        lstDataGrid.ColumnHeaders.Add , , oFields(i).Name
    Next
    
    
    oRS.MoveFirst
    Do While Not oRS.EOF
        Set oFields = oRS.Fields
        i = 0
        For i = 0 To oFields.Count - 1
            tempValue = Switch(IsNull(oFields(i + 1).Value), "", Not IsNull(oFields(i + 1).Value), oFields(i + 1).Value)
            If i = 0 Then
                Set oItem = lstDataGrid.ListItems.Add(1, , tempValue)
            Else
                oItem.SubItems(i) = tempValue
            End If
            If oFields(i + 1).IsPrimaryKey = True Then oItem.Tag = tempValue
        Next
        Debug.Print oFields(1)
        oRS.MoveNext
    Loop

    Set oItem = Nothing
    Set oFields = Nothing
    Exit Sub
Errhandler:
    Set oItem = Nothing
    Debug.Print Err.Description
    Set oFields = Nothing
End Sub