|
-
May 27th, 2011, 10:11 PM
#9
Re: Newb and VB
Yeah, I suppose it might not appear so neat, but it is what it is. One alternative would be to take all settings at form load and put them into a Dictionary(of String, String). The key would be the name, and the value would be the setting value. It would look something like this:
Private elDict as New Dictionary(Of String,String)
'In form load, or the form constructor:
elDict.Add("He", My.Settings.He)
elDict.Add("H",My.Settings.H)
...etc.
You would then be able to access any of the items using a line like this:
Dim words As String() = elDict(selectedel).Split(New Char() {","c})
When passed a valid key(selectedel), the dictionary returns the value, which is then being split using the code you have. Note that this will fail if you pass in a value in selectedel that is not already in the dictionary, because it will return Nothing, and you can't call .Split on that. In your case, this shouldn't be an issue, as you have complete control over what goes into the dictionary and what goes into selectedel.
My usual boring signature: Nothing
 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|