Private Sub DataGridView1_CellPainting(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellPaintingEventArgs) Handles DataGridView1.CellPainting
If e.ColumnIndex
Return
End If
Dim column As DataGridViewColumn
column = DataGridView1.Columns(e.ColumnIndex)
If column.DataPropertyName = "天車" AndAlso e.RowIndex >= CInt(HomePage1(1) - 1) AndAlso e.Value.ToString = "0" Then --------->>>>使用者程式碼未處理NullReferenceException (並未將物件參考設定為物件的執行個體)
e.CellStyle.ForeColor = Color.Blue
e.CellStyle.BackColor = Color.Blue
e.CellStyle.SelectionForeColor = SystemColors.Highlight
End If
If column.DataPropertyName = "." AndAlso e.RowIndex >= 0 AndAlso e.Value.ToString = "1" Then
e.CellStyle.ForeColor = Color.Orange
e.CellStyle.BackColor = Color.Orange
e.CellStyle.SelectionForeColor = SystemColors.Highlight
ElseIf column.DataPropertyName = "." AndAlso e.RowIndex >= 0 AndAlso e.Value.ToString = "0" Then
e.CellStyle.ForeColor = Color.FromArgb(255, 255, 255, 192)
e.CellStyle.SelectionForeColor = SystemColors.Highlight
End If
End Sub
This entry passed through the Full-Text RSS service — if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers. Five Filters recommends: