You can utilize a lambda statement to combine logic to get the count
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
DataGridView1.Rows.Add(New Object() {"CountMe"})
DataGridView1.Rows.Add(New Object() {"CountMe"})
DataGridView1.Rows.Add(New Object() {"Other"})
DataGridView1.Rows.Add(New Object() {"CountMe"})
DataGridView1.Rows.Add(New Object() {"CountMe"})
DataGridView1.Rows.Add(New Object() {"CountMe"})
DataGridView1.Rows.Add(New Object() {"Other"})
End Sub
Private Sub CountButton_Click(sender As Object, e As EventArgs) Handles CountButton.Click
Dim count = DataGridView1.Rows.OfType(Of DataGridViewRow).
Count(Function(row) Not row.IsNewRow AndAlso CStr(row.Cells("Column1").Value) = "CountMe")
CountLabel.Text = count.ToString()
If (count > 0) Then
MessageBox.Show("Exist!")
Else
MessageBox.Show("Nothing here!")
End If
End Sub
End Class
Case insensitive
Private Sub CountButton_Click(sender As Object, e As EventArgs) Handles CountButton.Click
Dim valueToFind = "CountMe"
Dim count = DataGridView1.Rows.OfType(Of DataGridViewRow).
Count(Function(row) Not row.IsNewRow AndAlso
String.Compare(CStr(row.Cells("Column1").Value), valueToFind,
StringComparison.InvariantCultureIgnoreCase) = 0)
CountLabel.Text = count.ToString()
If (count > 0) Then
MessageBox.Show("Exist!")
Else
MessageBox.Show("Nothing here!")
End If
End Sub