我在DRR(5)得到一個語法錯誤,其中5是我想基於顏色更改的列。 當我使用的數據集根據列值更改字體顏色gridview行。不能索引gridviewrow?
Dim Land As String = "Land"
Dim Air As String = "Air"
Dim Cruise As String = "Cruise"
Dim y As String
For Each drr As gridviewrow In GridView2.Rows
y = drr(5).ToString()
If y = Land Then
e.Row.ForeColor = System.Drawing.Color.LightGreen
ElseIf y = Air Then
e.Row.ForeColor = System.Drawing.Color.Red
ElseIf y = Cruise Then
e.Row.ForeColor = System.Drawing.Color.Green
End If
Next
奇怪沒有語法錯誤,但顏色仍呈現爲黑色 – MyHeadHurts 2011-02-01 20:38:39