views:

1139

answers:

2

I have an application with a DataGridView on it and I would like to position the rows such that a specific row is at the top of the list.

I don't want a sort, I want a way to programmatically tell the DataGridView "scroll to the Nth row."

Any ideas?

+6  A: 

How about FirstDisplayedScrollingRowIndex?

Marc Gravell
Holy cow. Where do they come up with these names? And I don't think I ever would have noticed this one, scrolling through that huge list of methods for DataGridView.
Michael Todd
Errr...properties, that is.
Michael Todd
+3  A: 

The DataGridView has a property called: FirstDisplayedScrollingRowIndex. Set that, and the row will then be at the top of the list.

BFree
Sorry, Marc beat you by about 30 seconds, plus he had a link....
Michael Todd
No sweat, he can use the rep more than I can :-P j/k
BFree
Hey! And there was me evening things up with a +1...
Marc Gravell
Hey man, if you're going to answer questions like these, you know some jacka$$ (like me) will make fun :-P
BFree
;-p besides, no amount of votes will help me due to the rep cap - but this way around, I get +15 (the most I can get), and you get +20, and everyone is happy ;-p
Marc Gravell