I have a LinkLabel
which is set up to receive some URLs that result from making a selection in a ComboBox
. What I'm trying to accomplish is for the user to select a state from my combo, and then be able to click the individual links that appear in link label.
Having my links in array, what I'm getting is the array displays the links as "one whole" string, and I want them to separate links. Here's what I have:
Public arrAlabama(2) As String
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' Create array for Alabama and add items.
arrAlabama(0) = "http://www.rolltide.com/"
arrAlabama(1) = "http://www.crimsontidehoops.com/"
arrAlabama(2) = "http://centralalabamapride.org/"
End Sub
Private Sub cboSelectState_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboSelectState.SelectedIndexChanged
' Populate the link label.
If cboSelectState.SelectedIndex = 0 Then
lnklblLinkbox.Text = arrAlabama(0) _
& vbNewLine & arrAlabama(1) _
& vbNewLine & arrAlabama(2)
End If
End Sub
I'll have about 3 other arrStateName
type arrays, so my SelectedIndex
will span from [0]
to [3]
, and each array will contain 3 URL links.
So where am I going wrong here? If anyone can give me a boost in the right direction I would appreciate it. Some suggested using Dictionary
data type, but I'm new to and when I tried test it out, I got frustrated because it doesn't seem to produce the results I want. Using the TKey
and TValue
throws me off, and I can never get all of my links to display in the box. I used Integer
for my keys, and String
for my values (links), but couldn't make it work. Some much needed guidance would be appreciated. Is what I'm trying to do possible, or should I be using some other control types?