DataTable - Add New Row as First Row

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?UGF1bA==?=

    DataTable - Add New Row as First Row

    I have an existing datatable with 3 rows.

    I want to programatically add another row but I want to insert that new row
    in the first position/row of the datatable.

    I know who to add the new row with:
    dr = datatable.newro w
    datatable.rows. add(dr)

    My problem is that I want to insert the new row into the first position of
    the table (in front of the original three rows).

    Possible?

  • Hermit Dave

    #2
    Re: DataTable - Add New Row as First Row

    DataTable.Rows collection which is DataRowCollecti on contains a method
    called InsertAt which can be used for this purpose




    HTH

    Hermit

    "Paul" <Paul@discussio ns.microsoft.co mwrote in message
    news:44950431-D62C-4C82-B4CE-A82A9D1010FD@mi crosoft.com...
    >I have an existing datatable with 3 rows.
    >
    I want to programatically add another row but I want to insert that new
    row
    in the first position/row of the datatable.
    >
    I know who to add the new row with:
    dr = datatable.newro w
    datatable.rows. add(dr)
    >
    My problem is that I want to insert the new row into the first position of
    the table (in front of the original three rows).
    >
    Possible?
    >

    Comment

    Working...