Results 1 to 2 of 2

Thread: datagrid

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2002
    Location
    London
    Posts
    678

    datagrid

    A win datagrid is populated by a dataset.
    This dataset varies for each population. i.e sometimes 4 fields and sometimes more or less...

    I would like to transfer this dataset and populate it into excel sheet.
    How can a dataset or the data in a datagrid be transfered into excel sheet.

    If I was using a DataReader I know how to loop through it and populate the excel sheet but with the Dataset I do not know

    Thanks

  2. #2
    Lively Member
    Join Date
    Sep 2002
    Location
    Belgium
    Posts
    99
    you can loop through a dataset like this :

    a dataset exists of one or more datatables so let's assume you have only one table in it.

    you can do this :

    dim dt as datatable = ds.tables(0)
    dt.rows.count (so you know the qty of rows in table with index 0.)

    for i=0 to dt.rows.count
    dt.rows(0)(i) '-> this gives you row by row from column0
    next

    This code is untested but it will help you for sure !

    HTH

    Bjorn

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