473,395 Members | 1,863 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,395 software developers and data experts.

DataGridView column sorting problem

Hey all, I feel like an idiot, but for the life of me I cannot figure out how to do this. Using C#, I have a DataGridView set up with a few thousand rows in it. I need to sort it according to 3 rows. Primarily by one that is a unique numerical value, second and then third by two other columns that can follow the normal sort. Any suggestions on how I go about doing that? Is there any built in functionality for that or am I going to have to manually sort each row.

Thanks
-Steve
Jul 20 '07 #1
1 1459
SammyB
807 Expert 512MB
The DataGridView sure is complicated! The functionality that you want is there, but you will have to write an IComparer or a SortCompare event handler to implement your sort rule. See the last two examples in http://msdn2.microsoft.com/en-us/lib...08(VS.80).aspx. HTH --Sam
Jul 20 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: rob | last post by:
I have a class that among others exposes a string property "Date". The date in this property is stored in the form yyyymmdd. Now I do the following 1) Generate a DataGridViewTextBoxColumn column...
1
by: cc | last post by:
Hi, using the DataGridView (.NET 2005) : I have a row currently selected in the Grid (say the 3rd row showing 'Product3') Now, when I click on a column to sort the records is the 'Product3'...
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...
0
by: mahesh.nimbalkar | last post by:
I want to use Multi column sorting in DataGridView. The scenario is like this: 1) DataGridView has two columns; Id and name 2) User clicks on Id column and DataGridView is sorted...
1
by: PawelR | last post by:
Hi Group, In my application I have DataTable which is displayed in DataGridView via DataView: DataView myView = new DataView(myTable); myDataGridView.DataSource = myView; One column im...
8
by: Kyote | last post by:
On my form I have a datagridview that's bound to a table on my DB. When I run the app then click on a column header to sort, it sorts just fine. But my problem is a result of that sort. Even...
4
by: ReneMarxis | last post by:
Hello i have one problem with sorting in an unbound DataGridView. I set sorting to automatic but i get errors when having DBNull values in the column that gets sort ("Object must be of type...
3
by: Frederik | last post by:
Hi group, I have a DataGridView that is mainly consisting of data bound columns. One column however is unbound. I'm not able to sort the grid on this column! Is that normal behaviour? If so,...
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 , , ...
7
Plater
by: Plater | last post by:
I am having trouble determining when my DataGridView object is sorting (based on a column header click). The idea is, in a large table, sorting the columns takes time, so I show a splash screen....
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: 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: 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
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?
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
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
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...

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.