473,394 Members | 1,841 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,394 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 3667
"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} Count: 25 ?entry.Contains("MachineName") ...
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 properties and methods of ListDictionary are...
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 - specifically how things work in relation to my...
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 possible.. who knows. I suppose it has to be some way...
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 TagPrefix="uc1" TagName="Header"...
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: Private Property StoredProcedureParams() As...
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 your post really helpful..but i wondered if, once...
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 test. I also have a get/set property for the...
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, the dialog box that appears has everything...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.