Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using My.Settings to save an array

Tags:

arrays

vb.net

How do you save an array or an ArrayList in VB.NET using My.Settings? I cannot find the array type anywhere, even in the browse window.

I know I can convert the array to a string, but I do not know how to convert a string to an array. I know that if I were to break it at a delimiter then I could convert a string to an array, but my problem is that any text at all could be stored within the array as a single value, so I cannot pick a delimiter that is unlikely to be used.

like image 407
Cyclone Avatar asked Sep 14 '26 02:09

Cyclone


2 Answers

I was also facing the same problem and I came up with a solution to this.

Here are the steps:

  1. Open up the properties of your app and select settings
  2. select the setting name and then where it says type click on the arrow and select browse.
  3. in the browse window type in system.collections.arraylist and hit enter!
  4. there you have your array!

You can use array like this:

your_array_name(here_comes_the_item_no.) = whatever

What kind of array? I've had luck using StringCollection for strings. ArrayList works for most anything else (and that's about the only place I'd use arraylist).

like image 37
Joel Coehoorn Avatar answered Sep 16 '26 22:09

Joel Coehoorn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!