Populating the DataGrid 
Author Message
 Populating the DataGrid

Public Function SpreadSheet(rs As ADODB.Recordset)
   Set DivList.DataSource = rs

   ' displaying the header portion og the DataGrid
   DataGrid1.Column(0).Caption = "Column1"
   DataGrid1.Column(1).Caption = "Column2"

   ' populating the DataGrid
   DataGrid1.???????????????
   DataGrid1.???????????????
End Function

As you must have understood from the above Function code that I'm trying to
call in the underlying recordset in the DataGrid1, which I don't know how to.
Please suggest something.

Thankyou in anticipation.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.*-*-*.com/ ;     Search, Read, Discuss, or Start Your Own    



Mon, 28 May 2001 03:00:00 GMT  
 Populating the DataGrid
Hi,

Here is my code from the project I am doing now.  You need to make some changes
for the columns.  

-------
Dim rs As Recordset
Dim GridRow as Integer
Dim Count As Integer

'Make sure the query returned at least one record
If rs.RecordCount > 0 Then

    'Get a count of records in the recordset and display it on the form.
    rs.MoveLast
    Count = rs.RecordCount
    lblCount.Caption = Count

    'Initialize the grid
    With grdValues
         .Row = Count + 1
         .Row = 0:
         .Col = 0: .Text = "Order ID"
         .Col = 1: .Text = "Order Date"
         .Col = 2: .Text = "Required Date"
         .Col = 3: .Text = "Shipped Date"
    End With

    'Populate the grid
    rs.MoveFirst
    For GridRow = 1 To Count
        With grdValues
            .Row = GridRow
            .Col = 0: .Text = rs![OrderID]
            .Col = 1: .Text = rs![OrderDate]
            .Col = 2: .Text = rs![RequiredDate]
            .Col = 3: .Text = rs![ShippedDate]
        End With
        rs.MoveNext
    Next GridRow
End If    



Tue, 29 May 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Populate a datagrid with notes.

2. Can ADO be used to populate a Datagrid?

3. How to populate a Datagrid

4. Using a List class to populate a datagrid

5. how to populate the datagrid changes to dataset?

6. Need help populating a datagrid from a recordset in VB6

7. Help me populating a DataGrid with a recordset

8. populating a datagrid control VB6

9. Populating VB6 datagrid

10. Populate an Datagrid with text from an .txt file

11. Populating a datagrid from a recordset

12. How to populate a Datagrid from SQL with a Server Side cursor

 

 
Powered by phpBB® Forum Software