VB5Populate the Grid
Sub FillGrid(AnyGrid, AnyRS)
   Dim i
   AnyGrid.Cols = AnyRS.Fields.Count
   AnyGrid.Rows = 1
   AnyGrid.Row = 0
   For i = 0 To AnyRS.Fields.Count - 1
      AnyGrid.Col = i
      AnyGrid.Text = AnyRS.Fields(i).Name
   Next
   Do While AnyRS.EOF <> True
      AnyGrid.Rows = AnyGrid.Rows + 1
      AnyGrid.Row = AnyGrid.Rows - 1
      For i = 0 To AnyRS.Fields.Count - 1
         AnyGrid.Col = i
         AnyGrid.Text = AnyRS.Fields(i)
      Next
      AnyRS.movenext
   Loop
End Sub
Listing 3 This generic routine populates a grid with records from an ADOCE recordset. Place this code in the module modGeneral.