title: Search delimited textfile in 2D array
body: <p>I have delimited a text file and put it into a 2D array. Then, I have tried to find out if the array contains the product ID (entered in a textbox). However, the code I have used to try to search the array and show the name does not work.
  The textfile says:
  1, Frances
  2, Emma</p>
  
  <p>Here is my code:</p>
  
  <pre><code>Public Class Form1
      Dim filename As String
      Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
          filename = "names.txt"
  
      End Sub
  
      Private Sub btnsearch_Click(sender As Object, e As EventArgs) Handles btnsearch.Click
  
  
          filename = "names.txt"
          FileOpen(1, filename, OpenMode.Input,,,)
  
          Dim lines() As String = IO.File.ReadAllLines("names.txt")
          Dim values(lines.Length - 1, 1) As String
          For i As Integer = 0 To lines.Length - 1
              Dim parts() As String = lines(i).Split(","c)
              values(i, 0) = parts(0)
              values(i, 1) = parts(1)
          Next
  
          Dim ID As String
          ID = txtidsearch.Text
  
          Dim line As String
  
          Do While Not EOF(1)
              line = LineInput(1)
  
              If values().Contains(ID) Then
                  lblid.Text = line
                  Application.DoEvents()
                  GoTo line1
              ElseIf EOF(1) = True
                  MsgBox("Not Found")
  
              End If
          Loop
  line1:
          FileClose(1)
  
      End Sub
  End Class
  </code></pre>
  
  <p>Thanks in advance</p>