473,386 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Problem with PropertyGrid and string based Collection

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? If it can't create a new object of one of the
built-in base types something is wrong.

Thanks,
Terry

Here's my "StringList" class for reference

using System;

using System.Collections;

namespace TestStringListAdd

{

/// <summary>

///

/// </summary>

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];

}

}

}

}
Nov 15 '05 #1
1 6418
I'll follow up on my own post with some additional information.

I discovered that "String" does not have a default constructor. Neither do
a number of other Framework classes, e.g. "IPEndPoint". So, if I were to
make a collection class of "IPEndPoint" derived from CollectionBase I run
into the same problem.

So, I guess the real question is how to handle these classes that don't have
default constructors so PropertyGrid can construct new instances of them?

Thanks!
Terry
"Terry" <ch**********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
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? If it can't create a new object of one of the
built-in base types something is wrong.

Thanks,
Terry

Here's my "StringList" class for reference

using System;

using System.Collections;

namespace TestStringListAdd

{

/// <summary>

///

/// </summary>

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];

}

}

}

}

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Dave Girvitz | last post by:
I have a PropertyGrid (Windows Forms App) based component that uses TypeConverters to generate ranges of acceptable values for properties. The idea was that I could download the key/value pairs...
2
by: Mevar81 | last post by:
Hi to everybody.I have a problem with the PropertyGrid control.I want to display not all the properties of a generic Control(Button,TextBox,ComboBox,ecc.).In general I don't want to display only...
2
by: Eric Eggermann | last post by:
Hello, I'm using a PropertyGrid on my form in lieu of a big ugly dialog box, or rather several large dialogs, so the user can manipulate some objects. I've got a font field that displays with a...
0
by: Steve Teeples | last post by:
I have a string collection within a class StringCollection scoll = new StringCollection(); public TestCaseProperties() { FunctionalitySupported(); scoll.Add("Apple"); scoll.Add("Banana"); }
1
by: ANDRES BECERRA | last post by:
Herfried K. Wagner was kind enough to point me to the PropertyGrid control http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemwindowsformspropertygridclasstopic.asp I have found a few...
12
by: Ron M. Newman | last post by:
Hi, I can load an assembly using the Assembly.Load(....) However, I'd like dynamic loading of assemblies to be identical to putting an assembly reference in your VS2005 project. and yes, I...
3
by: Brannon | last post by:
So when you use VS's View Designer, each object included is keyed off its Name. You cannot make the name the same as some other component. You can change the name in a PropertyGrid. I want to do a...
4
by: Rohan | last post by:
I need to use the Collection editor of the propertyGrid, but i can't this to work, i looked around on the NET on collection and I am kinda lost. i have this so far, i don't know what i should do...
0
by: michelqa | last post by:
I'm looking for a way to display a string collection where each element of the collection have some properties. By example : MyCollectionItem0 MyPropertyA MyPropertyB MCollectionItem1...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.