Results 1 to 3 of 3

Thread: populating a DataGrid control manually

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2001
    Location
    Crossroads of America
    Posts
    72
    I don't know if this is the only way, but one way is to create a "custom" ADO recordset and then attach this to the datagrid. ADO recordsets are generally a lot more friendly at data manipulation than the datagrid control...and you can create an ADO recordset without ever attaching to a database or anything.

    The following url is to an article explaining "custom" ADO recordsets:

    http://www.4guysfromrolla.com/webtech/071799-1.shtml

    Also, the recordset object can save and load .xml files, so if you wanted to store your data in this format...piece of cake.

    Good luck!

    Dave <><

  2. #2
    Addicted Member
    Join Date
    Jan 2000
    Location
    Sydney, Australia
    Posts
    196
    yep thanks, thats kinda how i ended up doing it, apparently the grid control can have a datasource of a DataSet, DataTable, DataView and DataViewManager...

    Given that i only have one "table" to display i just used a DataTable class, created it, populated it manually and then made that the DataSource for the class.

    I would say that if you do want to populate a DataGrid control manually then this is how it has to be done, ie creating one of these classes, populating them manually, then binding them to the grid. It just seemed like a stupid thing to have to do at first, but having done it it is not sooooo bad.

    cheers,

    funky

  3. #3
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Dublin (Ireland)
    Posts
    304
    You can also bind a datagrid to an array if you want to avoid using a custom data set.

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