【发布时间】:2014-07-18 12:53:32
【问题描述】:
我应该将颜色更改为包含参数“tarjeta_fam”的单元格。我尝试更改单元格默认属性,然后使该行无效以刷新它,但(显然)没有任何反应。可以从单元格格式化事件中更改单元格颜色吗?
Public Sub New(user As Usuario, ByVal tarjeta_fam As String)
InitializeComponent()
gridFamiliares.DataSource = BD.getTable(a query)
If Me.gridFamiliares.Rows.Count > 0 Then
For i As Integer = 0 To Me.gridFamiliares.Rows.Count - 1
If Me.gridFamiliares.Rows(i).Cells("tarjeta_fam").Value = tarjeta_fam Then
Me.gridFamiliares.Rows(i).DefaultCellStyle.BackColor = Color.Black
Me.gridFamiliares.InvalidateRow(i)
End If
Next
End If
End Sub
【问题讨论】:
-
conditional change of a datagridviews cell background color and text 的可能重复项...或从右侧“相关”下的许多其他选项中选择
-
指示为重复:更改此:
Me.gridFamiliares.Rows(i).Cells(index).Value.tostring = "tarjeta_fam "Then -
问题不重复,我在问是否可以改变颜色接收外部变量
标签: vb.net gridview datagridview cell