T
Terry
I created a collection derived from CollectionBase that is just made up of
strings, called "StringList". I have another object that has as a member
one of these StringList.
If I assign that object to a PropertyGrid, click on the collection editor
("...") and try to add a new string, I get an error message "Constructor on
type System.String not found.".
Any ideas what I'm missing? This works fine with any of the value types,
but classes like "String" and "IPEndPoint" do not have constructors, so how
can I tell the PropertyGrid collection editor to instantiate new objects
with a default value?
Thanks,
Terry
Here's my "StringList" class for reference
------------------------------------------
using System;
using System.Collections;
namespace TestStringListAdd
{
public class StringList : CollectionBase
{
public StringList()
: base()
{
}
public void Add( String str )
{
this.List.Add( str );
}
public void Remove( String str )
{
this.List.Remove( str);
}
public string this[ int index ]
{
get{return (String)this.List[index];}
}
}
}
strings, called "StringList". I have another object that has as a member
one of these StringList.
If I assign that object to a PropertyGrid, click on the collection editor
("...") and try to add a new string, I get an error message "Constructor on
type System.String not found.".
Any ideas what I'm missing? This works fine with any of the value types,
but classes like "String" and "IPEndPoint" do not have constructors, so how
can I tell the PropertyGrid collection editor to instantiate new objects
with a default value?
Thanks,
Terry
Here's my "StringList" class for reference
------------------------------------------
using System;
using System.Collections;
namespace TestStringListAdd
{
public class StringList : CollectionBase
{
public StringList()
: base()
{
}
public void Add( String str )
{
this.List.Add( str );
}
public void Remove( String str )
{
this.List.Remove( str);
}
public string this[ int index ]
{
get{return (String)this.List[index];}
}
}
}