• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1105
  • Last Modified:

VB.NET Datagridview default sorting mode...

Hi, I have 5 columns in datagridview, and when I'm trying to sort the data within the datagridview the columns are getting sorted in a very weird way. I have one column with text and 4 with integers. I need to make sure that the integer columns are sorted so that the highest integer is first or the lowest and obviously the text column can be sorted ascending
descenting

Thanks
0
VAL1N
Asked:
VAL1N
  • 5
  • 2
1 Solution
 
anarki_jimbelCommented:
Default sorting mode is automatic, that's what I figured out from a small test.

What is the data source for your DataGridView? Does underlying table has properly defined data types for columns?
0
 
VAL1NAuthor Commented:
Dim row As String() = New String() {item, FTickets, TTickets, OTickets, TotalTickets}

ContestDataView.Rows.Add(row)

This is how I add data.
0
 
VAL1NAuthor Commented:
datagridview is not bound to anything.
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
CodeCruiserCommented:
How did you add the columns? Did you specify the data types of columns? Can you not bind to an in memory datatable?
0
 
VAL1NAuthor Commented:
I added columns using the interface.

Columns
0
 
VAL1NAuthor Commented:
This is how the datatable is sorted...

Sorting...
0
 
CodeCruiserCommented:
I don't see any DataType property on those columns. If you bind to a data table, you can set the type of each column and the grid will then sort it based on that data type.
0
 
VAL1NAuthor Commented:
Thank you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now