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

  • How can I create a scheduled java application/task?

    Hi, Being a complete newbie to the Java language, I hope I am forgiven if the above is blindingly obvious. I have a java application which I have developed that when run from the command prompt (java xyz) selects a bunch of records from my database,

  • ISE 1.2 Patch 8 Endpoint icon Missing

    Hi, Has anyone seen an issue where the Endpoint icon under Identity just disappears. I upgraded to Patch 8 yesterday and all seemed fine but sometime this morning between adding enpoints the icon has gone. Very strange.

  • Travelling with Lightroom 4

    I am taking my laptop with me on a trip. All photos will be imported into Lightroom and some editing will be done while I am away. What can I do to be able to import those shots, (RAW and edited jpg's) into my desktop machine and have all my edits st

  • How to enable forms to be able to save form filled data?

    I've read that Adobe Reader XI now allows users to save data filled in forms. However, when I create a pdf file using LiveCycle, the from still says that the data cannot be saved. I'm using Designer ES4 btw. Thanks.

  • E-print on hp b109n

    i have a b109n printer set up on my wireless network and working fine with my windows pcs. i have added an ipad which is on the same wireless network and have installed and activated the hp e-print app. when i come to add my printer i am asked for it