-2

I am trying to read the cell and see if the invoice number has two dashes (-).

So for example:

4-2949493

4-9390023-1

If (e.Row.RowType = DataControlRowType.DataRow) Then
    If (e.Row.Cells(1).Text.ToString = (TWO DASHES) Then

    Else

    End If
End If

How would I check to see if it has two dashes? The invoice length changes every time too.

Carl R
  • 11
  • 3

1 Answers1

-1

Carl, Take the string text from the cell and loop through the characters counting the occurrences of the desired character:

Dim charCount as integer = 0
For each c as char in e.rows.cells(1).text.tostring.toCharArray
    If c = "-" then
        charCount += 1
    End If
Next