By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,685 Members | 1,326 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,685 IT Pros & Developers. It's quick & easy.

filling arrays from config.app values

P: n/a
I have an integer array that I want to fill from my config.app file...
i have this setup

dim myArray() as integer=appsettings.GetValue("myArray",
GetType(System.int32))
my configuration is set as follows
<add key="myArray" value="{6,7,15}" />

however i get an error saying the value is not an integer type....however if
i comment out my appsettings and put my values in curly braces on the line
it works fine...

any suggestions on how to do this?

Eric


Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi Eric,

It's a bit of an effort but..
Read the values as a string,
Remove the brackets.
Split it into an array of strings with Split (",")
Finally, convert each value to an Integer using Parse (or Val).

Regards,
Fergus
Nov 20 '05 #2

P: n/a
* "Eric Cathell" <ec******@mountaire.com> scripsit:
I have an integer array that I want to fill from my config.app file...


Notice that the config file should _not_ be used to save preferences...

--
Herfried K. Wagner
MVP VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.