Getting Columns that contains a certain string

boomboombugsh

Member
Joined
Dec 30, 2011
Messages
5
Programming Experience
Beginner
Hey :)
I made a DataGridView that displays multiple columns
And within this DataGridview, it has a column FirstNAme, MiddleName, LastName, QuizAverage, Quiz1, Quiz2, Quiz3 etc
How can I get the columns that contains the string "Quiz" such as QuizAverage, Quiz1, Quiz2, Quiz3 etc.. without identifying their index?
Thanks for help in this regard :)
 
I will assume that you mean that that is the text in the header of each column. There would be multiple variations but they'd all be something like this:
For Each column As DataGridViewColumn In myDataGridView.Columns
    If column.HeaderText.Contains("Quiz") Then
        'Match found
    End If
Next
 
Back
Top