i've an ArrayList Saved in My.Settings i am trying to Access it using some string, Here is the code so you get what i am trying to do
If listBoxEdit1.SelectedIndex > -1 Then
My.Settings("Sup" & listBoxEdit1.SelectedIndex + 1 & "(1)") = Convert.ToDouble(Margin2TextBox.Text)
End If
i need to specify the value for My.Settings.Sup1(1)
How would you do it?
i've Multiple ArrayLists which goes form My.Settings.Sup1 to My.Settings.Sup20
so the listBoxEdit1.SelectedIndex+1
specifies the number of the ArrayList but i can't figure out how to get the index
also tried
My.Settings("Sup" & listBoxEdit1.SelectedIndex + 1 &"("& 1 & ")")
also
My.Settings("Sup" & listBoxEdit1.SelectedIndex + 1).Item(1)
Select
StringCollection
as Type of your setting.Then you can easily access a specific element with an index.
Edit
If your setting is called
Sup1
, you can access it viaMy.Settings("Sup1")
or My.Settings("Sup" & whatever). Then, you have yourArrayList
orStringCollection
and can access its items like every otherArrayList
orStringCollection
.So your code should probably read:
Here's another example: