Using Collection Editor Problem...thx


G

Guest

Hi,
When I am using the Collection Editor, the left hand side member always
display the collection class name.
1. How to display specify property name?(e.g. Collection of TabPage in
TabControl, it can show TabPage.Name value instead of
"System.Windows.Form.TabPage")

2. How to do increament of the object Name??(e.g. Collection of TabPage in
TabControl, it can be "TabPage1".."TabPage2"....to be increament, so what do
i need to implement this case?

Thx
 
Ad

Advertisements

C

Claes Bergefall

When I am using the Collection Editor, the left hand side member always
display the collection class name.
1. How to display specify property name?(e.g. Collection of TabPage in
TabControl, it can show TabPage.Name value instead of
"System.Windows.Form.TabPage")
The display string for each item in the left pane of the collection editor
is taken from the specific item according to the following (in order of
priority):
1. If a Name property exists and is non-empty, that value is used
2. If a default property exists and it is non-empty and of type string, that
value is used
3. If the value from the ToString method is non-empty, that value is used
4. Otherwise the name of the type of the item is used

At least this was the case in 2003. I haven't tried it in 2005
So either provide a Name property, a default property or override ToString
for the type of objects you put in your collection.

/claes
 

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