06-20-2015, 09:00 PM
(This post was last modified: 06-20-2015, 09:05 PM by brandonio21.)
Hello strawman83,
I think that to resolve this issue you have two reasonable solutions.
1) Create a new ComboBoxItem object that has a "tag" field that contains the text of the blog post. That is, you can do something like this:
Of course, this option is fairly complicated since you will need to make a custom version of the ComboBox object and a new ComboBoxItem class.
2) Make a List that mirrors the ComboBox. This is often the solution that I use to this problem since it is so simple. Your code will then look something like this:
In this method, the indices of the blog text and the blog "aliases" are synced, so that when the user selects an alias, they are also selecting the index of the corresponding text. I hope this helps!
I think that to resolve this issue you have two reasonable solutions.
1) Create a new ComboBoxItem object that has a "tag" field that contains the text of the blog post. That is, you can do something like this:
Code:
while j < blogLineCount
  blogAlias = blogArray(i).Substring(1,9)
Dim item as New ComboBoxItem
item.text = blogAlias
item.tag = blogArray(i)
  combobox1.Items.Add(item)
Of course, this option is fairly complicated since you will need to make a custom version of the ComboBox object and a new ComboBoxItem class.
2) Make a List that mirrors the ComboBox. This is often the solution that I use to this problem since it is so simple. Your code will then look something like this:
Code:
Dim text as New List<String>()
while j < blogLineCount
blogAlias = blogArray(i).Substring(1,9)
comboBox1.Items.Add(blogAlias)
text.Add(blogArray(i))
' This function is called when the user changes the ComboBox item
Private Sub Item_Changed(ByVal obj as Object, ByVal e as EventArgs) Handles comboBox1.SelectedIndexChanged
TextBox1.Text = text.Item(comboBox1.SelectedIndex)
End