473,473 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

set datagridview sort back to nothing

VS 2005/Pro

I'm using a DataGridView in a Windows form and allowing the user to sort the
columns by clicking on the header column.

Is there some method offered by the grid to return back to the unsorted
view?

I think I could "roll my own" by resetting the bindingsource.sort = nothing,
but it seems like the datagridview should have something like this?

Rick
Apr 8 '07 #1
2 4402
Rick,

I never tried it, but can you use the dataview for the datasource and than
set the sort attribute to its initial which is "".

Please give us the result if this works.

Cor

"Rick" <Ri**@LakeValleySeed.comschreef in bericht
news:%2****************@TK2MSFTNGP02.phx.gbl...
VS 2005/Pro

I'm using a DataGridView in a Windows form and allowing the user to sort
the columns by clicking on the header column.

Is there some method offered by the grid to return back to the unsorted
view?

I think I could "roll my own" by resetting the bindingsource.sort =
nothing, but it seems like the datagridview should have something like
this?

Rick

Apr 8 '07 #2
Cor,
I'm not sure you understood.

I can do this now - capture the column header right click and change the
binding source sort to "". See code below.

I wanted to know if the datagridview ALREADY has a built-in method to do
this. For example when you left click on the left header column above the
row marker, you select all the rows in the grid. Is there something that
will unsort the grid that is already in the datagridview component?

Private Sub gridPOItems_ColumnHeaderMouseClick(ByVal sender As
System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellMouseEventArg s) Handles
gridPOItems.ColumnHeaderMouseClick
If e.Button = Windows.Forms.MouseButtons.Right Then
If gridPOItems.SortedColumn IsNot Nothing Then
POItemsbind.Sort = ""
End If
End If
End Sub

Rick

"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:Ov**************@TK2MSFTNGP03.phx.gbl...
Rick,

I never tried it, but can you use the dataview for the datasource and than
set the sort attribute to its initial which is "".

Please give us the result if this works.

Cor

"Rick" <Ri**@LakeValleySeed.comschreef in bericht
news:%2****************@TK2MSFTNGP02.phx.gbl...
>VS 2005/Pro

I'm using a DataGridView in a Windows form and allowing the user to sort
the columns by clicking on the header column.

Is there some method offered by the grid to return back to the unsorted
view?

I think I could "roll my own" by resetting the bindingsource.sort =
nothing, but it seems like the datagridview should have something like
this?

Rick


Apr 8 '07 #3

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

Similar topics

10
by: milk-jam | last post by:
I'm trying to set my datagridview so that the first row will be left blank and to use it as a filtering filed for the datagridview. Until now I was using 2 datagridview the upper one with a header...
2
by: inpuarg | last post by:
Is it possible that - or is there any workarround for adding a new unbound row to a datagridview at bound mode ? Theese are not working. And i don 't want to add a row to dataset then rebind -...
10
by: Crazy Cat | last post by:
Hi, I am dynamically creating datagridviews for my application, then filling them with data from a 30 row datatable, and everything seems to work great with one exception. My horizontal...
1
by: sapkal.manish | last post by:
Question : How can I find actual row position of DataTable in DataGridView when DataTable is sorted / My source code like this Private WithEvent dgvInwDet as new DataGridView Private...
4
by: Matt | last post by:
I have been searching all over the web for a way to sort a DataGridView based on the actual text being shown in a ComboBox column as opposed to the underlying value (an ID in this case). Can anyone...
3
by: mac | last post by:
I have a datagridview that I populate with the result of a web service. The webservice sends multiple rows back with each row as one element of an array. I use a for loop and the...
2
by: Tolgan | last post by:
I have an object class "Person" say, with various public properties including say "Name" and "Salary" I have several person objects that I have created by some method outside the scope of this...
0
by: Niyazi | last post by:
Hi, I have a form with DataGrid view and details and its working fine. In the sepaerate button I want to update the database table columns. The value comes from AS400 and inserted into string...
3
by: Daniel Manes | last post by:
I need a strategy to debug this situation... I can't put all the code involved, but here are some of the critical lines with comments: ------------------------- Private _parentDataCell As...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.