Here is my code so far, I have a list box which shows the name read from a text file. Then I have two text box: txtName and txtPhone. When the name is highlighted in the list box, it should show the name in the txtName and the phone nunber in the txtPhone but it is not working as it should. Any help is appreciated.
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim memberphones() As String = IO.File.ReadAllLines("memberphones.csv")
Dim query = From line In memberphones
Let data = line.Split(","c)
Let name = data(0)
Let phone = data(1)
Select name
lstOutput.DataSource = query.ToList
txtName.Text = Name
txtPhone.Text = phone
End Sub
End Class
here is the content of my text file: Carol Preiss,587-2333 Alice Rees,860-9744 Carlos Sanchez,209-4587 John Smith,576-2988