G
G
Grand Silence2014-08-29 01:17:39
C++ / C#
Grand Silence, 2014-08-29 01:17:39

How to make correct sorting of datagridView column in C#?

Good day, friends. Faced such problem: sorting of a column in dataGridView goes by the principle of string sorting. My dataGridVew is passed a table from the database, with certain columns (`order_id` = 1..100 -> int++, `order_total` = "****.00" -> string). So, how to sort so that the string `order_total` is first converted to a float, and then sorted numerically?
Thanks for any helpful replies. Thank you. PS: if I expressed myself vaguely, I will explain in more detail in the comments.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2014-08-29
@r4tz52

DataGridView.Sort Method (IComparer)
Make your own sorter that implements the IComparer interface and substitute it into the Sort() method;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question