Simple string list in a property grid

M

michelqa

Hi,

I'm trying to display a list of string in the string collection editor
just like the "items" property of an ListBox in VS IDE....

I can find many examples on the net but I cant find any example like
items property of a listbox... I mean the String collection editor
with the text "Enter the strings in the collection (on per line)"

Is anybody can point me to the right object to use to define my string
collection object and/or a way to show the string collection editor
like ListBox items ??

Thanks,
 
C

Ciaran O''Donnell

To get that exact editor you need to apply the attribute:
[Editor("System.Windows.Forms.Design.ListControlStringCollectionEditor,
System.Design, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]

to the property, that however generates code like this:

this.listBox1.Items.AddRange(new object[] {
"sdfg",
"wef",
"wef",
"wef",
"wefwef",
"wef"});
 
M

michelqa

THANKS!!!!!!!!!!!!!!!!

after loosing hours trying to find how to do this it finally works!!

Thanks again!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top