Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Go top a specified row in a table
Message
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
00957940
Message ID:
00957947
Vues:
15
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform