VB.Net中DataGridView控件列按数字排序的解决方法
2009-01-15 20:09
405 查看
Private Sub dgvResult_SortCompare(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewSortCompareEventArgs) Handles dgvResult.SortCompare
If e.Column.Index > 0 Then
If dgvResult.Columns.Item(e.Column.Index).HeaderText.IndexOf("N") > 0 Then
If (Val(e.CellValue1) < Val(e.CellValue2)) Then
e.SortResult = -1
ElseIf Val(e.CellValue1) = Val(e.CellValue2) Then
e.SortResult = 0
Else
e.SortResult = 1
End If
e.Handled = True
End If
End If
End Sub
If e.Column.Index > 0 Then
If dgvResult.Columns.Item(e.Column.Index).HeaderText.IndexOf("N") > 0 Then
If (Val(e.CellValue1) < Val(e.CellValue2)) Then
e.SortResult = -1
ElseIf Val(e.CellValue1) = Val(e.CellValue2) Then
e.SortResult = 0
Else
e.SortResult = 1
End If
e.Handled = True
End If
End If
End Sub
相关文章推荐
- 解决:VB.NET程序中 datagridview 多次绑定出现 的“不能在数据绑定的 DataGridView 控件上设置 ColumnCount
- 解决:VB.NET程序中 datagridview 多次绑定出现 的“不能在数据绑定的 DataGridView 控件上设置 ColumnCount
- [VB.NET]如何在DataGridView控件中增加、删除和修改记录(用程序代码的方法)
- 解决:VB.NET程序中 datagridview 多次绑定出现 的“不能在数据绑定的 DataGridView 控件上设置 ColumnCount
- asp.net 用户控件中 使用相对路径的解决方法-------- 图片路径问题(用户控件、图片路径) ,ResolveUrl
- asp.net自动完成控件在用户控件上失效的解决方法
- VB.NET中DataGridView控件
- 打开VB开发工具提示:Imagelist来自mscomctl.ocx控件出错,可能是mscomctl.ocx过期,解决方法
- VB.NET 添加控件方法
- [VB.NET]在vb.net中有没有类似vb6控件数组的方法控制一组控件?
- ASP.NET中TextBox使用Ajax控件显示日期不全的问题解决方法
- 最近被winform里的datagridview ADO.NET的dataset dataadapter以及跨表弄得蛋疼不行,解决方法就是换方法!
- ASP.NET中TextBox使用Ajax控件显示日期不全的问题解决方法
- VB.net 关于程序单实例问题的解决方法
- C#与VB.NET服务器端控件的基本表示方法(学习之四)
- 机房重构-DataGridView常用使用方法(vb.Net版)
- 在VS.net调试环境中运行网站程序时ReportViewer控件的工具栏显示为英文的解决方法
- VB.NET DataGridViewComboBoxColumn控件赋值
- VB CommonDialog控件选择多个文件,报"实时错误20477",解决方法
- NET VBCSCompiler.exe占用100%,造成项目卡顿的的解决方法