1 Replies - 4304 Views - Last Post: 05 May 2011 - 10:02 PM Rate Topic: -----

#1 icyboy  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 50
  • Joined: 07-September 09

Move up down row with bound datagridview

Posted 05 May 2011 - 09:06 PM

Dear All,

I want to move row up down with a bound datagridview with event click of button?

Can you help me?

Thanks
Is This A Good Question/Topic? 0
  • +

Replies To: Move up down row with bound datagridview

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9579
  • View blog
  • Posts: 36,297
  • Joined: 12-June 08

Re: Move up down row with bound datagridview

Posted 05 May 2011 - 10:02 PM

Get the selected row's index, increment/decrement as needed and set that to the selected row.

Off the top of my head:

            System.Windows.Forms.DataGridView foo = new DataGridView();
            foo.Rows[foo.SelectedRows[0].Index + 1].Selected = true;
            foo.Rows[foo.SelectedRows[0].Index -1].Selected = true;

This post has been edited by modi123_1: 05 May 2011 - 10:05 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1