Private Sub dataGridView1_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) _
Handles dataGridView1.CellFormatting
If dataGridView1.Columns(e.ColumnIndex).Name.Equals("YOURCOLUMN") Then
If CInt(e.Value) < 0 Then
e.Value = "(" & Math.Abs(e.Value).ToString("N") & ")"
End If
End If
End Sub
2 回答
您可以设置该列的默认格式:
有关格式化的更多信息可以在here找到 .
回答你的意见 .
在SQL中执行此操作会为您的查询添加如下内容:
要么
在vb.net中执行: