title: Looping through alternative (every other) DataGridView column
body: <p>I know you can loop through alternating rows of a <code>DataGridView</code> but I can't find any help on looping through alternating columns. I've tried using the code below which sounds like it would work on paper but keeps breaking.</p>
  
  <pre><code>    Dim i As Integer
  
      i = i + 1
  
      For i = 1 To 5
          Dim value6 As Integer = DataGridView1.Rows(e.RowIndex).Cells(i).Value
          Select Case value6
              Case "1"
                  DataGridView1.Rows(e.RowIndex).Cells(i).Style.BackColor = Color.LightBlue
              Case "2"
                  DataGridView1.Rows(e.RowIndex).Cells(i).Style.BackColor = Color.Chartreuse
              Case "3"
                  DataGridView1.Rows(e.RowIndex).Cells(i).Style.BackColor = Color.Orange
          End Select
      Next i
  </code></pre>
  
  <p>It keeps breaking when it gets to a column with a date because it's not an integer.</p>
  
  <p>I've inserted a picture of the <code>DataGridView</code> below but I want the code to loop through every other column with an integer and read the value, starting at column(2) ending at column(6).</p>
  
  <p>Any help would be appreciated!</p>
  
  <p><a href="https://i.stack.imgur.com/ybLnf.png" rel="nofollow noreferrer">DataGridView Image</a></p>