How do i split a line in a csv file and populate a combobox and a textbox with the parts

What I'm trying to do is split the line and fill a combobox and with the selecteditem and the textbox with the value of the combobox selecteditem which is the second part of the line split.
Thanks in advance for the help or suggestions.

Then you should create a class to represent the items in the ComboBox:
Public Class MyItem
Public Property PartA As String
Public Property PartB As String
End Class
...and add instances of this class to the ComboBox:
Try
Dim mydocpath1 As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
Dim mylines() As String = File.ReadAllLines(mydocpath1 + "\TextFile1.txt")
For Each line In mylines
Dim parts() As String = line.Split(","c)
Dim item As MyItem = New MyItem With {.PartA = parts(0), .PartB = parts(1)}
cmb1.Items.Add(item)
Next line
cmb1.SelectedItem = cmb1.Items(1) 'select second item
Catch ex As Exception
MsgBox(ex.Message)
End Try
Then you set the DisplayMemberPath of the ComboBox to the name of one property and bind the Text property of the TextBlock to the other one:
<ComboBox Name="cmb1" DisplayMemberPath="PartA" />
<TextBlock Text="{Binding ElementName=cmb1, Path=SelectedItem.PartB}" />
That should solve your issue.
Once again, please remember to mark helpful posts as answer to close your threads and remember that a new thread deserves a new question.

Similar Messages

Maybe you are looking for

  • Questions on Room State

    Hey guys,      I got some questions on room state:      1) Does the room state actually take some effect or just an indicating flag? For example, if a room state is ROOM_STATE_ENDED, will it prevent any incoming user connection?      2) I tried to lo

  • Is it possible to control an itunes library located on an iMAC from a

    I am trying to set up a sound system for a blind person using an ipad as a controller. The  itunes music library is located on a iMAC and there is a Wifi network with an Airport Express located elsewhere. The ipad has the Remote App and Airport utili

  • Linking multiple sheets?

    Greetings, I have a Numbers 09 workbook with multiple (40) sheets that I would like to be able to link to a summery sheet. The cell on the summery sheet would sum all of the data from the same cell in all other 40 sheets as it is changed. I was able

  • Filter Issue in ALV Grid

    I am displaying the table in ALV Grid format. I have 4 fields in the table. The filter works for the first 3 fields, but doesnot work for the last field. Please let me know what might be the issue. Find the table declaration and the table population

  • Mac book pro and bigpond email (australia)

    i just got my macbook back as the hard drive decided it did not want to work anymore. since then i have attempted to set up my email account and it just does not work, only one that works is my iCloud email. i would really appreciate some assistance