Absent Member.
Absent Member.
1825 views

DataGridView Sort Column

Jump to solution

Confused I need to sort a column of datagridview object using code after to fill it.

Does anyone have any examples?

Thank you

0 Likes
1 Solution

Accepted Solutions
Absent Member.
Absent Member.

Worked . Thank you very much.

View solution in original post

0 Likes
4 Replies
Absent Member.
Absent Member.

Hi Altair,

This can be done with the "Sort" method using code such as:-

           invoke self::dataGridView1::Sort(dataGridView1::Columns["Nome"] , type System.ComponentModel.ListSortDirection::Ascending)

Regards

David

0 Likes
Absent Member.
Absent Member.

Worked . Thank you very much.

View solution in original post

0 Likes
Vice Admiral
Vice Admiral

I also came up with this question today.  I had searched the net and found this C # example:

this.dataGridView1.Sort(this.dataGridView1.Columns["Name"], ListSortDirection.Ascending);

at this link:  stackoverflow.com/.../sort-datagridview-colums-in-c-sharp-windows-form

but I was not able to successfully convert it from C# to VC without syntax errors.

I was just about ready to give up when I decided I would search this forum.  I'm glad I did!  Thanks!

0 Likes
Absent Member.
Absent Member.

Thank you David.Sands. I works like a champ.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.