Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim searchid, id, i As Integer
Dim price As Double
Dim fin As IO.StreamReader = IO.File.OpenText("supermarket.txt")
i = 1
searchid = TextBox1.Text
While (fin.Peek <> -1)
'While (i <= 5)
id = fin.ReadLine
price = fin.ReadLine
If id = searchid Then
TextBox2.Text = FormatCurrency(price)
Exit While
End If
i = i + 1
End While
If fin.Peek = -1 Then
TextBox2.Text = "Item Not Found"
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
End Sub
End Class