Questions tagged [stringcollection]

Represents a collection of strings in C#

40 questions
1
vote
2 answers

How to retrieve last item in StringCollection array

I'm trying to get the last item in string collection array with this: scWords(0).Item(0) & "-" & scWords(0).Item(scWords(0).Count)) It keeps saying out of range
Gmac
  • 169
  • 2
  • 14
1
vote
0 answers

Application Settings | System.Collections.Specialized.StringCollection Only Saves One Value

In the application settings I have a setting called Locations and the type is a System.Collections.Specialized.StringCollection. I also have a textbox and a button that are supposed to add values to the StringCollection. After entering the value…
user4605835
1
vote
2 answers

StringCollection editor does not store the values entered by user

I have implemented StringCollection editor in my custom control and below is the code : [Description("extra free-form attributes on this thing.")] [Editor(@"System.Windows.Forms.Design.StringCollectionEditor," + "System.Design, Version=2.0.0.0,…
user1291401
  • 264
  • 1
  • 6
  • 18
1
vote
2 answers

How delete string from stringCollection saved in settings

I'm new in this community. I've a problem: I follewed this How I can save controls created in run time in Windows Forms and the code work very well, but I've a problem when I want to delete a string from the stringCollection. I used the method…
0
votes
5 answers

How to generate a unique string from a string collection?

I need a way to convert a strings collection into a unique string. This means that I need to have a different string if any of the strings inside the collection has changed. I'm working on a big solution so I may wont be able to work with some…
Moslem Ben Dhaou
  • 6,897
  • 8
  • 62
  • 93
0
votes
1 answer

Join StringCollection with commas

Usually, joining a List with commas is easy using string.Join(). However, coming across a StringCollection today, string.Join() outputs "System.Collections.Specialized.StringCollection" output instead of a comma-separated string. [TestMethod] …
Denis G. Labrecque
  • 1,023
  • 13
  • 29
0
votes
2 answers

Initializing a StringCollection from My.Settings to avoid null reference exception

I am specifying a System.Collections.Specialized.StringCollection named MyCollection in My.Settings, and upon first use to add a string, a null reference exception is being thrown (i.e. MyCollection is Nothing). The syntax to add a string is…
user16594857
0
votes
1 answer

Windows Update API CopyToCache(IStringCollection) - Specified cast is not valid

For reducing traffic on our VPN routes, I need to download the windows updates from an external server while reporting to our internal server. So I'm doing the following: Create an UpdateSession and Search for Updates, storing them in…
Eldo.Ob
  • 774
  • 4
  • 16
0
votes
0 answers

Difference between Specialized String collection and Generic list C#

What is the difference between a Specialized String Collection and a Generic String List in C#? And how to convert a Specialized one into a Generic one? System.Collections.Specialized.StringCollection specialized = new…
Dave
  • 1,912
  • 4
  • 16
  • 34
0
votes
3 answers

Change sorting of StringCollection

On my current project the user can create a control that gets docked in a TableLayoutPanel. The controls name gets saved in a StringCollection and on every start of the program the controls get recreated. I would like to implement a feature that…
Backslash
  • 99
  • 1
  • 10
0
votes
1 answer

C# StringCollection in Custom Class

Given the class below, what would be the correct way to add multiple strings to the StringCollection called blob_key_col_name? public class blob_info { public string column_name { get; set; } public string blob_value { get; set; } public…
user3308131
  • 159
  • 1
  • 5
  • 16
0
votes
1 answer

Serialize String-collection object for storing in session variable

In my ASP.Net application, I'm storing a string collection in a Session variable. It was working fine but now I want to change session settings from in-proc to Out Proc. Now I'm having an issue that "Non-Serializable Object Stored in Session". How…
rinesh
  • 493
  • 1
  • 8
  • 26
0
votes
0 answers

String Collections in Settings aren't changing their size

I have several string collections in my C# project that are stored in Settings. At the beginning of this project, I had initialized these collections to contain 20 values, all being 0s. Lately I've realised I actually need about 100 0s in each…
J.Doe
  • 713
  • 1
  • 6
  • 19
0
votes
1 answer

How to access an indexed string from a string collection saved in settings?

I have a few arrays of strings in my settings labelled meas1, meas2, meas3 etc... If I want to set the 6th item in each string collection to "", how would I do that? Below is my broken code of failed attempt: for (int i = 19; i >= 0; i--) { …
J.Doe
  • 713
  • 1
  • 6
  • 19
0
votes
1 answer

How to load assembly [Systems.Collections.Specialized.StringCollection] into Powershell

I semi understand what I'm asking and have tried to research this as best as I'm able. I'm trying to use an object of type [Systems.Collections.Specialized.StringCollection]: $newDBFiles = new-object…