473,387 Members | 3,801 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.

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 12833
Martin

Have a look at this

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

I hope this helps,

Cor
"martin1" <ma*****@discussions.microsoft.comschreef in bericht
news:99**********************************@microsof t.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.SortedColumn.SortMode = DataGridViewColumnSortMode.NotSortable

"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*****@discussions.microsoft.comschreef in bericht
news:99**********************************@microsof t.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.Columns("column_name").SortMode =
DataGridViewColumnSortMode.NotSortable

"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.SortedColumn.SortMode = DataGridViewColumnSortMode.NotSortable

"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*****@discussions.microsoft.comschreef in bericht
news:99**********************************@microsof t.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
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...
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: 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...
3
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...
2
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...
7
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...
0
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...
4
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...
6
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 , , ...
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: 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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.