我正在使用以lstPats
vb.net形式命名的C1List控件。lstPats
有id,patname,patemail列,lstPats
如果patemail
value为null ,我需要给行上色
到目前为止,我所做的是
启用了lstPats的fetchrowstyle属性
以下是我在
lstPats_FetchRowStyle
事件中编写的代码
For i As Integer = 0 To lstPats.ListCount - 1
If lstPats.GetItemText(i, 2) <> "" Then /* checks the patemail is null or not*/
e.CellStyle.ForeColor = Color.Green
End If
Next
问题是所有行lstPats
变成绿色,我只需要列中包含空值的行patemail
您需要像下面这样重写FetchRowsStyle
Event中的代码,以仅突出显示一些行
Dim val As String = Me.lstPats.Columns(2).CellText(e.Row).ToString
If val <> "" Then
e.CellStyle.BackColor = Color.Green
End If
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句