[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1097
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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