Results 1 to 5 of 5

Thread: DataGrid Help

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2008
    Location
    XP & Vista
    Posts
    181

    Exclamation DataGrid Help

    Hello guys ,

    I am new to here... I need the output as shown below... So please edit my code according to the output.

    My code:

    Code:
    Dim r As ADODB.Recordset
    
    Private Sub Form_Load()
    
    Set r = New ADODB.Recordset
    
    With r.Fields
    .Append "First name", adBSTR
    .Append "Second name", adBSTR
    .Append "Third name", adBSTR
    End With
    
    r.Open
    
    r.AddNew 0, "Siva"
    r.AddNew 1, "Chand"
    r.AddNew 2, "SivaChand"
    
    Set DataGrid1.DataSource = r
    
    End Sub
    For the above code output:

    First name Second name Third name
    Siva
    Chand
    Sivachand

    But i want the output like this:

    First name Second name Third name
    Siva Chand Sivachand
    test1 test2 test3

    Please help me to make this change..... Advance thx....

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: DataGrid Help

    Welcome to the forums.

    What are you outputting it to?

  3. #3
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,515

    Re: DataGrid Help

    Try,

    Code:
    r.Addnew
        r![first name] = "siva"
        r![second name] = "Chand"
        r![third name] = "sivachand"
    r.Update

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Feb 2008
    Location
    XP & Vista
    Posts
    181

    Re: DataGrid Help

    Above code fill the datagrid in diagonal [ie (0,0) (1,1) (2,2) (3,3)....] cell only. But i want to fill all the cells [ ie (0,0) (0,1) (0,2) (0,3)....]. For that what i do?

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Feb 2008
    Location
    XP & Vista
    Posts
    181

    Resolved Re: DataGrid Help

    Quote Originally Posted by wes4dbt
    Try,

    Code:
    r.Addnew
        r![first name] = "siva"
        r![second name] = "Chand"
        r![third name] = "sivachand"
    r.Update

    Thanks for your quick reply Wes4bt... Its helpful for me... Thanks once again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width