473,606 Members | 2,200 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataGridView column sort

All,

..Net 2.0 DataGridView column sort is automatic, I don't want column sort, is
anybody know how to not sort column in DataGridView?

Thanks
Jul 3 '06 #1
3 12850
Martin

Have a look at this

http://msdn2.microsoft.com/en-us/library/95scxcdy.aspx

I hope this helps,

Cor
"martin1" <ma*****@discus sions.microsoft .comschreef in bericht
news:99******** *************** ***********@mic rosoft.com...
All,

.Net 2.0 DataGridView column sort is automatic, I don't want column sort,
is
anybody know how to not sort column in DataGridView?

Thanks

Jul 3 '06 #2
Hi, Cor,

when using following code to disable column sort and get "Object reference
not set to an instance of an object" error message, it is NullReference
Exception, the dataGridView1 is already created by draging the datagrid onto
the form, can you help this out? Thanks

DataGridView1.S ortedColumn.Sor tMode = DataGridViewCol umnSortMode.Not Sortable

"Cor Ligthert [MVP]" wrote:
Martin

Have a look at this

http://msdn2.microsoft.com/en-us/library/95scxcdy.aspx

I hope this helps,

Cor
"martin1" <ma*****@discus sions.microsoft .comschreef in bericht
news:99******** *************** ***********@mic rosoft.com...
All,

.Net 2.0 DataGridView column sort is automatic, I don't want column sort,
is
anybody know how to not sort column in DataGridView?

Thanks


Jul 6 '06 #3
use column_name like below works

DataGridView.Co lumns("column_n ame").SortMode =
DataGridViewCol umnSortMode.Not Sortable

"martin1" wrote:
Hi, Cor,

when using following code to disable column sort and get "Object reference
not set to an instance of an object" error message, it is NullReference
Exception, the dataGridView1 is already created by draging the datagrid onto
the form, can you help this out? Thanks

DataGridView1.S ortedColumn.Sor tMode = DataGridViewCol umnSortMode.Not Sortable

"Cor Ligthert [MVP]" wrote:
Martin

Have a look at this

http://msdn2.microsoft.com/en-us/library/95scxcdy.aspx

I hope this helps,

Cor
"martin1" <ma*****@discus sions.microsoft .comschreef in bericht
news:99******** *************** ***********@mic rosoft.com...
All,
>
.Net 2.0 DataGridView column sort is automatic, I don't want column sort,
is
anybody know how to not sort column in DataGridView?
>
Thanks
Jul 6 '06 #4

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

Similar topics

10
13340
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 that sort and one row for filtering and the lower one with no header for the data. Only it is very complicated to work this way cause for example when the user click on sort on the upper datagridview I need to sort the lower grid and so on when...
4
8626
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 tell me if this is even possible, and if so, how to do it? If this is completely impossible, how would you suggest going about sorting a ComboBox wherein the text displayed in the column is the client's name, and the underlying value is an ID? ...
3
11935
by: joey.powell | last post by:
I have a datagridview where I set its "DataSource" property to a DataSet and its "DataMember" property to a table within the DataSet. I need for the DataGridView to "sort" through the contents of the DataSet as it binds. Can I specify a column on the DataSet that, sorted, will control the order of the rows in the datagridview? It seems to just parse over the data in the DataSet and bind to it, without my being able to control the order...
3
56181
by: Freddy Coal | last post by:
Hi, I'm learning to use the Datagridview; I would like sort a column of my DGV, but with code, not with user click over the column, how make that?; Mi other question is how search for a especific chain in my DGV?. Thanks in advance for any help, I'm using VB.Net in VS2005. Freddy Coal
2
4409
by: Rick | last post by:
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?
7
15640
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is there an equivalent property for the DataGridView? I have searched, but have not found one. I would like the user to be able to see all the columns of the table on one screen - thus eliminating the need to use the horizontal scroll bar to view...
0
1966
by: Hassan | last post by:
Hi, Im using visual studio 2005,C#2 Framework 2.0 In my program, i have a DataGridView where DataGridView.DataSource equal to a BindingSource.DataSource and this BindingSource.DataSource equalt to a DataTable. i handled the event ColumnHeaderMouseClick to perform a sort. i tryied this methods: 1/BindingSource.Sort=mydgvColumn.Name+" ASC ";
4
19798
by: NvrBst | last post by:
I have a log viewer. I sort the DataGridView by the Time Column and then run a function to set all cell backcolors depending if the cell above is different. This works correctly, however, when I resort a column (by clicking any of the column headers) then all the colors revert back to the origional white background. Is there a way to have the DefaultCellStyle for each cell follow the value/cell on sort?
6
4726
by: stocki | last post by:
Hi, On my WinForm I have a DataGridView, which contains four columns and four rows. The last row contains only a sum of the values of the cells of the previous rows in column 3. The cells , , are empty ( ). ="Mr." ; ="Smith" ; ="David" ; =1000 ="Mrs."; ="Fog" ; ="Denise" ; =2000 ="Mr." ; ="Ranger"; ="Stuart" ; =3000
0
8015
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7951
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8439
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8094
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
5966
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3930
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2448
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 we have to send another system
1
1553
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1296
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.