Results 1 to 4 of 4

Thread: [2005] Move a Row Up And Down in a dataset???

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,806

    [2005] Move a Row Up And Down in a dataset???

    Hi Peeps,

    I have a dataset which is bound to a datagrid. I also have a move up and down button. If I select a row in my datagrid how do you code the up and down buttons to move the selected row???

    Any help please,,,

    Jiggy!

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Move a Row Up And Down in a dataset???

    Bind the table to a BindingSource and that to the grid, then set the Sort property of BindingSource to sort on some sequential numeric column. To change the order of the rows just swap the values in that column and the rest is done for you.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,806

    Re: [2005] Move a Row Up And Down in a dataset???

    Hi Mate,

    Thank you for your reply; I am writing a sort number. Do you have an example of the BindingSource as I have never used this.

    Thank you,

    Jiggy!

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Move a Row Up And Down in a dataset???

    As always, go to the MSDN documentation, type in bindingsource and start reading.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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