472,336 Members | 1,322 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

User Control - ListDictionary property

I'm trying to create a user control that would have a ListDictionary
property. When trying to use the property and set values for this
collection, the dialog box that appears has everything disabled. I'm
unsure of what I have to have set in code in order to enable this??

Jul 21 '05 #1
4 3606
"Doug" <dn******@dtgnet.com> wrote in news:1115038097.606701.212890
@o13g2000cwo.googlegroups.com:
I'm trying to create a user control that would have a ListDictionary
property. When trying to use the property and set values for this
collection, the dialog box that appears has everything disabled. I'm
unsure of what I have to have set in code in order to enable this??


There is no designer for this class. You would need to write a designer.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Get your ASP.NET in gear with IntraWeb!
http://www.atozed.com/IntraWeb/
Jul 21 '05 #2
I'm not sure I understand your answer. Basically, I need a way to have
my user control contain a collection property (it doesn't have to be a
list dictionary one). So if I have a property like this:

private ListDictionary m_oValues = new ListDictionary();
[MergableProperty(false)]
[RefreshProperties(RefreshProperties.All)]
public ListCollection Values
{
get
{
return m_oValues;
}
set
{
m_oValues = value;
}
}

In the properties box this property will show up with an ellipsis.
When I click the ellipsis the Object Collection Editor box will display
but everything is disabled.

I've been doing some reading and it seems that you need a seperate
class that inherits from CollectionBase to do this. So I wrote one
just for a test:

public class Test : CollectionBase
{
public void Add(string o)
{
List.Add(o);
}
public void Remove(string o)
{
List.Remove(o);
}
public string this[int index]
{
get
{
return (string)List[index];
}
set
{
List[index] = value;
}
}
}

and then switch the code that read like this:

private ListDictionary m_oValues = new ListDictionary();

to this:

private Test m_oValues = new Test();
That seemed to work, and the ADD button was now enabled in the Object
Collection Editor, however when I tried to use the ADD button, I got
the error "Constructor on System.String not found". So apparently, my
collection cannot be of a string type.

I'm really unsure of what I'm doing here or if I'm going way down the
wrong path. What I need is the ability to have a control with a
collection property that develpers can add and remove info from.

Jul 21 '05 #3
One other thing. I figured out how to do this if I went with a
StringCollection instead of a ListDictionary. However that won't work
for me as it brings the string collection editor and only allows one
entry (per line), it doesn't have an option for description and value.
I'm hoping to have a collection that does something like this:

Description = Yes Value = Y
Description = No Value = N
Description = Unknown Value = U

Jul 21 '05 #4
"Doug" <dn******@dtgnet.com> wrote in news:1115043776.235345.221630
@l41g2000cwc.googlegroups.com:
I'm not sure I understand your answer. Basically, I need a way to have
Properties, especially classes just dont "magically" have editors in Visual
Studio. Someone has to write them. Microsoft made editors for many of the
common classes, but other classes that it didnt make sense to make a generic
editor for, or just didnt make sense they didnt.

So you have to write a property editor for your class/property, or
ListDictionary if you want it to be that generic.
In the properties box this property will show up with an ellipsis.
When I click the ellipsis the Object Collection Editor box will display
but everything is disabled.


Because its probably invoking some default editor with basic actions.

--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Empower ASP.NET with IntraWeb
http://www.atozed.com/IntraWeb/
Jul 21 '05 #5

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

Similar topics

0
by: Jim Douglas | last post by:
{System.Collections.Specialized.ListDictionary.NodeKeyValueCollection} : {System.Collections.Specialized.ListDictionary.NodeKeyValueCollection} ...
6
by: Allen Jones | last post by:
Hi, I tried to extend ListDictionary in order to create a thread safe version named SynchronizedListDictionary. Despite the docs saying the...
2
by: Doug | last post by:
Not that I'd actually do this... but knowing the answer would give me a bit more understanding of the .NET Framework and the base class libraries -...
0
by: Gabriel Cirera | last post by:
Hello, Is it possible to fill a DataGrid with a ListDictionary? I tried to find the solution in this groups but I couldn't... Maybe is not...
6
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register...
2
by: SK | last post by:
Hello, I am trying to convert an object to a ListDictionary, but I get always the error: Specified cast is not valid. Here is my code: ...
4
by: louise raisbeck | last post by:
Resending this as own topic as didnt get answer from original. Would be grateful for a response from anyone that knows. Thanks. Hi there, I found...
1
by: John Keenan | last post by:
I have a user control with 2 buttons on it & 1 label.... as each button is pressed, they set a member variable within the class and sets the label...
4
by: Doug | last post by:
I'm trying to create a user control that would have a ListDictionary property. When trying to use the property and set values for this collection,...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

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.