请问如何实现点击listview的每一列的标题,这一列就自动排序。
解决方案 »
- C#里的问题
- 如何在Webbrowser控件获取指定部分的内容
- asp.net导出Word错误
- 用流读文件的时候,文章有几段,读出来的是字符串,怎么分段,再用什么控件在网页显示好。
- 条码打印位置混乱,问题,请高手帮忙分析分析代码,谢谢!!
- 关于datagridview的问题 求大神帮忙啊
- RowState 可以实现在DataGrid 中的新增新行的保存吗,在C# WinForm环境中
- 除了Form以外,还有没有什么其他控件可以作为Form的容器?
- 关于得到数据库中所有表名的问题,一天之内结贴!!!
- oracle 数据库的迁移 有没有大神懂的?现在导入数据有问题啊?求指教
- listview中如何对数字类型进行排序???急.谢谢
- sql2000中的搜索语句,怎么得到返回值,并赋给textbox
public class ListViewItemComparer : IComparer
{
private int col;
public ListViewItemComparer()
{
col = 0;
}
public ListViewItemComparer(int column)
{
col = column;
}
public int Compare(object x, object y)
{
return String.Compare(((ListViewItem)x).SubItems[col].Text, ((ListViewItem)y).SubItems[col].Text);
}
}
//事件处理
private void processList_ColumnClick(object sender,System.Windows.Forms.ColumnClickEventArgs e)
{
ListView1.ListViewItemSorter = new ListViewItemComparer(e.Column);
ListView1.Sort();
}
http://www.microsoft.com/china/MSDN/library/netFramework/netframework/NFdnwinformslistviewsort.mspx
http://www.microsoft.com/china/MSDN/library/enterprisedevelopment/softwaredev/dnwinforms.mspx