Phylum123 Posted December 4, 2002 Posted December 4, 2002 I know how to detect if a user has clicked on a column header, using a hittest. What I want to know is how to SIMULATE programically as if a user has clicked on a column header. Is this possible? Phylum Quote
Phylum123 Posted December 4, 2002 Author Posted December 4, 2002 (edited) Let me clarify why I want to be able to do this. I am making my own variation of the datagrid. I am trying to make a property for MY datagrid that allows you to know which column the datagrid is currently sorted by and which way (Asc or Dsc). Remember the user can hit a column header to resort the grid. Are there any properties that allow you to figure this out with the default datagrid? Edited December 4, 2002 by Phylum123 Quote
*Gurus* Derek Stone Posted December 4, 2002 *Gurus* Posted December 4, 2002 You don't simulate the clicking of the header. Instead you create a property that remembers for you. This property is then updated when the user clicks a header, or when your program changes the sorting. Quote Posting Guidelines
Phylum123 Posted December 5, 2002 Author Posted December 5, 2002 The thing is I wanted the property to be setable. I.E. dg1.sortcolumn =1. Quote
*Gurus* Derek Stone Posted December 5, 2002 *Gurus* Posted December 5, 2002 So pogram it that way. There's nothing stopping you from taking the same code that sorts the data when a header is clicked and using it when that property is set. Quote Posting Guidelines
Phylum123 Posted December 6, 2002 Author Posted December 6, 2002 How do I tell the datagrid to sort by column 1 for instance? Phylum Quote
*Gurus* Derek Stone Posted December 6, 2002 *Gurus* Posted December 6, 2002 Associate a DataView object with your data set. DataView objects allow you to rearrange rows, thereby also sorting them. myDataView.Sort = "LastName, FirstName DESC" Quote Posting Guidelines
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.