I have 5 text boxes: Phone, Pager, cell, voicemail, and email. They need to auto populate when a name is selected from a combo box. Data used to populate both the combo boxes, and text boxes come from the same text file.
An example of what the data looks like in the text file:
Mickey
204-5555
666-555
777-7777
888-8888
23w@hhh.ra
I've gotten to the point where I can load the names from the text file to the ComboBox, using the code provided below.
But How do I get the text boxes to populate, after I’ve selected a name from the combo box?
Public Class BlackBookLookup
Private fileName As String
Dim FileLines As New List(Of String)
Private Sub mmuOpenTool_Click(sender As Object, e As EventArgs) Handles mmuOpenTool.Click
Dim BlackBookDialogResult As DialogResult
Using fileChooser As New OpenFileDialog()
BlackBookDialogResult = fileChooser.ShowDialog()
fileName = fileChooser.FileName
End Using
If BlackBookDialogResult <> DialogResult.Cancel Then
MessageBox.Show(OpenFileDialog1.SafeFileName)
End If
If IO.File.Exists(fileName) Then
FileLines.AddRange(IO.File.ReadAllLines(fileName))
If FileLines.Count > 1 Then
For x = 0 To FileLines.Count - 1 Step 6
chooseNameComboBox.Items.Add(FileLines(x + 0))
Next
End If
End If