locked
copy row in the bindingsource RRS feed

  • Question

  • BH

    Hi,

    i have a tripsbindingsource that is bound to a database.  I want to create a new row, which is a copy of the selected row (excluding the index column).  To create a new row i'm using:

    ambtrans4Dataset.TripsRow NewTripsRow = ambtrans4DataSet.Trips.NewTripsRow();

    But how do i actually, copy all the information from an existing row to the "NewTripsRow" (excluding indexcolumn)?

    Thanks so much for all your help.

    Aron


    Thanks Aron www.EvidenceForTorah.comxa.com

    Thursday, April 5, 2012 3:18 AM

Answers

  • hi,

    For Each guest As DataRow In guests
                        newguest = _ds.AppointmentAttendee.NewRow
                        newguest.ItemArray = guest.ItemArray
                        newguest.Item("When_From") = newRowInf.newrow.When_From
                        _ds.AppointmentAttendee.Rows.Add(newguest)
                    Next


    Regards, Nico

    • Marked as answer by Allen_MSDN Monday, April 9, 2012 2:32 AM
    Friday, April 6, 2012 6:40 AM

All replies

  • Hi,

    you can use the itemarray property to copy the content from one row to another.

    See here:

    http://msdn.microsoft.com/en-us/library/system.data.datarow.itemarray.aspx


    Regards, Nico

    Thursday, April 5, 2012 8:30 AM
  • BH
    Hi Nico,

    Could you please give an example?
    Thanks

    Aron


    Thanks Aron www.EvidenceForTorah.comxa.com

    Friday, April 6, 2012 2:48 AM
  • hi,

    For Each guest As DataRow In guests
                        newguest = _ds.AppointmentAttendee.NewRow
                        newguest.ItemArray = guest.ItemArray
                        newguest.Item("When_From") = newRowInf.newrow.When_From
                        _ds.AppointmentAttendee.Rows.Add(newguest)
                    Next


    Regards, Nico

    • Marked as answer by Allen_MSDN Monday, April 9, 2012 2:32 AM
    Friday, April 6, 2012 6:40 AM