Here is a question in VB6 you could do something like this to go through all the cells in a MSHFlexGrid1

PHP Code:
    With MSHFlexGrid1
      
For iCol 0 To MSHFlexGrid1.Cols 1
        
If iCol 1 Then
          mstTitle 
= .TextMatrix(iRowiCol)
        
End If
        If 
iCol 2 Then
          mstDescription 
= .TextMatrix(iRowiCol)
        
End If
        If 
iCol 13 Then
          mstRecordID 
= .TextMatrix(iRowiCol)
          
GetRecordID
        End 
If
        
stColumnHeader MSHFlexGrid1.ColHeaderCaption(0iCol) & ": "
        
stDisplayText stDisplayText stColumnHeader & .TextMatrix(iRowiCol) & vbCrLf vbCrLf
      Next
    End With 
Now in VB.NET I am trying to do something like that when a user clicks a cell in a DataGrid.

PHP Code:
        With DataGrid2.Item(iColiRow)
            For 
iCol 0 To DataGrid2.VisibleColumnCount
                stColumnHeader 
DataGrid2.CaptionVisible.ToString ": "
                
stDisplayText stDisplayText stColumnHeader DataGrid2.Item(iRowiCol) & vbCrLf vbCrLf
            Next
        End With 
But in this line "For iCol = 0 To DataGrid2.VisibleColumnCount" instead of DataGrid2.VisibleColumnCount I want the total column count any ideas?