C# 表名发货单,列名利润,利润列数据小于0的单元格显示红色
private void 发货单DataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (e.Value == null)
return;
if (发货单DataGridView.Columns[e.ColumnIndex].Name = "利润" && int.Parse(e.Value.ToString() < 0))
{
e.CellStyle.BackColor = Color.Red;
}
}
int.Parse(e.Value.ToString() < 0) 报错,错误1运算符“<”无法应用于“string”和“int”类型的操作数C:\Users\wangxin\Documents\Visual Studio 2010\Projects\WindowsFormsApplication3\WindowsFormsApplication3\Form1.cs4381WindowsFormsApplication3
请问如何修改,
[解决办法]
int.Parse(e.Value.ToString()) < 0
[解决办法]