473,387 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

datagrid sort order

i have a win form w/ a datagrid inside
while the app is running many instances of this form r created and closed
how can i ensure that the sort user used last time is kept until the whole
app is
closed

TIA
Nov 20 '05 #1
4 3654
John:

Here's my answer from the WindowsForms ng
Create a DataView as a static property and bind everything to it. If you
need seperate datasources with the same sort order, same thing... static
class storing the Index of the column you want sorted on . Every time you
bind the grid, set the sort order (ideally of a dataview) to that
columnindex.

If you are in VB.NET, you can just use modules if you are uncomfortable with
Static properties, they are quite similar.

HTH,

Bill

www.devbuzz.com
www.knowdotnet.com
"John Smith" <a_*@abv.bg> wrote in message
news:#R**************@TK2MSFTNGP12.phx.gbl...
i have a win form w/ a datagrid inside
while the app is running many instances of this form r created and closed
how can i ensure that the sort user used last time is kept until the whole
app is
closed

TIA

Nov 20 '05 #2
Hi John,

When you create a dataview you can save the last sortorder as
\\\
Dim sortcolumnAndOrder As String = dv.Sort
////
However only the last column that is clicked not multiple columns.

I hope this helps?

Cor
Nov 20 '05 #3
tnx, ill try - but its not too simple :((
"William Ryan eMVP" <do********@comcast.nospam.net> wrote in message
news:O6**************@TK2MSFTNGP09.phx.gbl...
John:

Here's my answer from the WindowsForms ng
Create a DataView as a static property and bind everything to it. If you
need seperate datasources with the same sort order, same thing... static
class storing the Index of the column you want sorted on . Every time you
bind the grid, set the sort order (ideally of a dataview) to that
columnindex.

If you are in VB.NET, you can just use modules if you are uncomfortable with Static properties, they are quite similar.

HTH,

Bill

www.devbuzz.com
www.knowdotnet.com
"John Smith" <a_*@abv.bg> wrote in message
news:#R**************@TK2MSFTNGP12.phx.gbl...
i have a win form w/ a datagrid inside
while the app is running many instances of this form r created and closed how can i ensure that the sort user used last time is kept until the whole app is
closed

TIA


Nov 20 '05 #4
i`ll try this too

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:Oq**************@tk2msftngp13.phx.gbl...
Hi John,

When you create a dataview you can save the last sortorder as
\\\
Dim sortcolumnAndOrder As String = dv.Sort
////
However only the last column that is clicked not multiple columns.

I hope this helps?

Cor

Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Martin Clark | last post by:
Hi, I have a C# Windows .net application (not asp.net) which uses a datagrid to display information. The datagrid is populated from a DataView, in which I specify a sort order ("ORDER BY...
5
by: Bill Todd | last post by:
In a WinForms application with a DataGrid bound to a DataTable, if I change the DefaultDataView.Sort property the order of the data in the grid does not change. If I change the Sort property...
1
by: Maqsood Ahmed | last post by:
Hello! There is a DataGrid on a form that is populated through DataTable and filters have been applied to through DataView. The DataTable gets updated through some events and obviously it also...
2
by: Snig | last post by:
Hi, I want to sort the DataGrid according to the number of clicks of mouse on the column-header link. e.g. if user clicks on the header once - it will be sorted ASC if the header is...
2
by: enak | last post by:
I can not get my datagrid to page. I have a datagrid that I can sort 2 of the columns. This works great. I added paging and when I display the dg it shows 5 pages. (I am showing page numbers at...
7
by: DC Gringo | last post by:
I have a datagrid that won't sort. The event handler is firing and return label text, just not the sort. Here's my Sub Page_Load and Sub DataGrid1_SortCommand: -------------------- Private...
1
by: Hrvoje Vrbanc | last post by:
Hello all! I would be grateful if someone could offer me some help with the following problem: I have a DataGrid control with sort enabled. Therefore it could be sorted in several different...
5
by: Kurt Schroeder | last post by:
I'm using VS.net. I have created a component with the basic set of database commands. This component returns a record set that is bound to a datagrid. I want to add a dynamic sort, but am not sure...
0
by: Nathan Franklin | last post by:
Hello Guys, I have been trying to work this our for so long, but I just can't seem to find the answer. I am loading a datatable from a an access database using an oledbdataadapter. I then...
0
by: rn5a | last post by:
A DataGrid control displays records from a SQL Server 2005 DB table. The AllowSorting property of the DataGrid has been set to True & the SortExpressions of the BoundColumns have been set to the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.