使用整数数据对无边界datagridview文本框中的2列进行排序 [英] Sort 2 columns in unbounded datagridview textbox with integer data

查看:121
本文介绍了使用整数数据对无边界datagridview文本框中的2列进行排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
如何在datagridview中对2行进行排序,并在文本字段中放置整数值. (在Visual Studio 2010中)
用户以编程方式输入网格而没有数据源.
我为字符串多列查找了很多信息,但是我需要使用值而不是字符串对字段进行排序.在2个cilumns上.
像:

赢了,得分
3,30
3,20
3,10
2,20
2、10
1,-5
0,-20
.....

Hello,
how to sort 2 rows in a datagridview with integer values put in textfields. (in visual studio 2010)
The grid is entered programatically without a datasource by the user.
I find lots of info for string sort multiple columns, but i need the field to sort with the value, not the string. on 2 cilumns.
like:

won , score
3, 30
3, 20
3, 10
2, 20
2, 10
1, -5
0, -20
.....

推荐答案

请查看我对问题的评论.

是的,您不需要字符串排序.您需要对数据集进行排序,并使用绑定或通过实现IComparer使用自定义顺序.请参阅以下讨论: http://social.msdn. microsoft.com/Forums/zh-CN/winformsdatacontrols/thread/c86a387e-3469-489a-a988-c765d70f84d7 [
Please look at my comment to the question.

Right, you don''t need string sorting. You either need to sort on the data set and use binding or using custom order via implementation of IComparer. See this discussion: http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/c86a387e-3469-489a-a988-c765d70f84d7[^]; see also the articles referenced on this page and MSDN help pages on the mentioned topic.

—SA


这篇关于使用整数数据对无边界datagridview文本框中的2列进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆