hi, im having trouble putting msgbox..

where do i put


MsgBox("Passenger not found!", MsgBoxStyle.Critical, "Error")

If name is not found from text file
help

thankz in advance
VS 2010

Private Sub btnRemove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRemove.Click
        Dim i As Integer
        Dim removename As String
        Dim found As String

        removename = InputBox("Enter Name to Remove", , )
        Dim FindText As String = removename
        Dim removetext As String = ""  ' remove
        For i = 1 To 40 Step 1

            If user(i) = removename Then
                ' If Not user(i) = removename Then
                seat(i).Text = "Open"
                found = True
                seat(i).Enabled = True
                seat(i).Size = New Size(100, 40)
                seat(i).BackColor = Color.Green
                seat(i).Font = newFont
                MsgBox("Passenger Removed")
                ''
                removetext = IO.File.ReadAllText("namessz.txt") ' Read all Text
                Dim pos As Integer = removetext.IndexOf(FindText)
 if pos = -1 then MsgBox("Passenger not found!", MsgBoxStyle.Critical, "Error"): return 
                Do While pos <> -1
                    removetext = removetext.Remove(pos, FindText.Length)
                    pos = removetext.IndexOf(FindText)
                Loop
                IO.File.WriteAllText("namessz.txt", removetext) ' Write specific Text
                ''

                ''
            End If
        Next i
    End Sub

solved please Del.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.