Results 1 to 4 of 4

Thread: Accecing a row in a dataset through a datagrid[RESOLVED]

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2003
    Location
    Gothenburg
    Posts
    4

    Question Accecing a row in a dataset through a datagrid[RESOLVED]

    Hi, I posted this early on the wrong forum, so....
    Ok here we go:
    I have this xml (shortned)
    <Avsyning>
    <model>Membran</model>
    <length>0</length>
    <ANGLE>
    <Pos>44</Pos>
    <Neg>22</Neg>
    </ANGLE>
    </Avsyning>
    This is read to bounded to a datagrid with
    datagrid1.SetDataBinding(dSet, "avsyning")

    No dataview is used (should I?)
    Now I want to (in run time) delete a row in the dataset.

    dataset1.Tables("Avsyning").Rows.RemoveAt(datagrid.currentrowIndex)

    This will delete the wrong row if i sort the datagrid1. The rowIndex is the current row in the datagrid, but to get the row in the dataset what todo? I think a have a solution but it only works if the user don't navigate down to a child (datagrid.currentRowIndex has the value of the index for the parent row... Not the child row. Feels realy strange to me!).

    Thanks for (any) help!

    edit: Tried to explane some more
    Last edited by onis; Apr 11th, 2003 at 06:23 AM.

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    how about try

    dataset1.Tables("Avsyning").Rows(datagrid.currentrowIndex).Delete

    Perhaps?
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3
    Lively Member
    Join Date
    Nov 2002
    Location
    Malaysia
    Posts
    124
    VB Code:
    1. Me.BindingContext(DataSet, "Table").RemoveAt(Me.BindingContext(DataSet, "Table").Position)

  4. #4

    Thread Starter
    New Member
    Join Date
    Apr 2003
    Location
    Gothenburg
    Posts
    4

    Thanks alot

    Execellent! it worked as planned now.
    Thanks chinhow !
    thanks to Cander too for taking your time =)

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