0
問題是空值大於十進制值0.00,因此排序問題會以升序排列。DataGridView在Decimal列中用空值排序
Private Sub dgvTable_SortCompare(ByVal sender As Object, ByVal e As DataGridViewSortCompareEventArgs) Handles dgvTable.SortCompare
If e.Column.Index = 4 Then
e.SortResult = System.Decimal.Compare(todecimalnull(e.CellValue1), todecimalnull(e.CellValue2))
End If
e.Handled = True
End Sub
Function todecimalnull(ByVal cellvalue)
If cellvalue = "" Then
Return "0.0"
Else
Return cellvalue
End If
End Function
我想通過使用上面的代碼先null然後0.0000,plz幫助我儘快 – user3733960