我要做的是:FIRST:如果TRUE继续,检查Cell Value是否存在。 SECOND:如果False MsgBox无效票证。
Private Sub changefound()
Dim findtxt As String = txt_Find.Text
Try
If DataGridView2.Rows.Count > 0 Then
For i As Integer = 0 To DataGridView2.Rows.Count - 1
Dim CellChange As String = DataGridView2.Rows(i).Cells("CODE").Value.ToString 'This is line 363
If CellChange.Contains(findtxt) = True Then
If Not IsDBNull(DataGridView2.Rows(i).Cells("STATUS").Value) _
AndAlso DataGridView2.Rows(i).Cells("STATUS").Value = "IN" Then
MsgBox("Ticket Used")
Exit Sub
Else
With DataGridView2
.Rows(i).Cells("STATUS").Value = "IN"
Exit Sub
End With
End If
End If
Next
End If
Catch e As Exception
MessageBox.Show(e.ToString())
End Try
'''''''''''''''''''If Flase Only Works Here''''''''''''''''''''''
Try
If DataGridView2.Rows.Count > 0 Then
For i As Integer = 0 To DataGridView2.Rows.Count - 1
Dim CellChange As String = DataGridView2.Rows(i).Cells("CODE").Value.ToString
If CellChange.Contains(findtxt) = False Then
MsgBox("InValid Ticket")
Exit Sub
End If
Next
End If
Catch e As Exception
MessageBox.Show(e.ToString())
End Try
End Sub
问题是我一直收到错误MSGBOX