Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Go top a specified row in a table
Message
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
00957940
Message ID:
00957947
Views:
14
Hey, Einar,

Assuming your datagrid is bound to a datatable, you can access the position property of the grid's binding manager...for example...
myGrid.DataSource = myTable;      (or myGrid.DataSource = myTable.DefaultView)

BindingManagerBase bMgr =  myGrid.BindingContext[myGrid.DataSource,myGrid.DataMember];
bMgr.Position = 0;   // will go to the top
bMgr.Position = myTable.Rows.Count-1;   // will go to the bottom    (or myTable.DefaultView.Count)
this.Refresh();
And if you want to highlight the row afterwards, you can do a...
myGrid.Select(  <row# to highlight>  );
Let me know if that helps...

Also...I have an article in the most recent issue of CoDe magazine that covers the Winforms datagrid, and offers some productivity tools for the grid. Here's a link to the first page (you need to be a subscriber to read the entire article):

http://www.code-magazine.com/Article.aspx?quickid=0411081


Kevin
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform