How to edit StringCollection in C# PropertyGrid? ["Constructor in type 'System.string' not found"]

256 Views Asked by At

Using Settings Editor I created some user settings for my application. In one specific instance, I need a setting to be an array of strings. The only option I encounter is StringCollection:

Choosing the data type in settings editor

When I edit the content while still in Settings Editor (clicking on the three dots) a simple editor gets invoked, where I can enter my strings, line by line:

String Collection Editor

I created a simple form for my users to edit those settings, creating a PropertyGrid and tying it to the default settings:

propertyGrid1.SelectedObject = Properties.Settings.Default;

When I edit the StringCollection there, I get a different String Collection Editor: Run-time String Collection Editor

I can edit or remove the entries just fine, but if I try to add one, I get the following error: "Constructor in type 'System.string' not found".

Is there a simple way to have property grid use the same editor the design-time editing of the Settings does?

0

There are 0 best solutions below