Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub Button1_Click(sender As Object, e As EventArgs)
- For ColIdx As Integer = 7 To 22
- For RowIdx As Integer = 1 To DataGridView1.Rows.Count - 1 '//angefangen von erster Zeile weil die erste Zeile die Titelzeile ist - ZeilenIndex fangt mit 0 an
- If GetBool(DataGridView1.Item(ColIdx, RowIdx).Value) = True Then
- DataGridView1.Rows(RowIdx).DefaultCellStyle.BackColor = Color.Red
- End If
- Next
- Next ColIdx
- End Sub
- ''' <summary>Get the bool property of the passed object</summary>
- ''' <param name="Element">Element to convert</param>
- ''' <returns>Boolean property; false is conversion does not work ...</returns>
- Private Function GetBool(ByVal Element As Object) As Boolean
- If Element.GetType Is GetType(Boolean) Then Return CBool(Element)
- If Element.GetType Is GetType(String) Then
- If CStr(Element).Trim.ToUpper = "TRUE" Then Return True Else Return False
- End If
- Return False
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement