vb.net 数据表在颜色方面表现出色

马斯·哈乔

在 vb.net 中,我有数据表,其中数据库中的值是格式。

在此处输入图片说明

当我想用规则制作样式和颜色时,这可能吗:

if nilai2 >= nilai1 then 
          hasil.backcolor = color.red
else if nilai2 < nilai1 then 
          hasil.backcolor = color.white
end if

输出 : 在此处输入图片说明

之前谢谢

马斯·哈乔

我得到了答案。这是我的代码:

xlrange = sobjSheet.Range(columnName & "2:" & columnName & "" & dgvhasil.RowCount + 1)
With xlrange
            .FormatConditions.Add(Excel.XlFormatConditionType.xlCellValue, Excel.XlFormatConditionOperator.xlLess, "0")
            .FormatConditions(1).font.ColorIndex = 3
        End With

感谢您的关注

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章