473,396 Members | 1,997 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,396 software developers and data experts.

Collection property not working

Hello,
I am designing a .net custom control in VS.net 7.1 and my control exposes an
array of strings which are supposed to be the items to show. To do this have
declared a private string[ ] variable and a public property which returns
it.
string[] options = new string[1];

public string[] Options

{

get

{

return options;

}

set

{

options = value;

}

}

It works fine in the disigner and I can add items to the list using the
VS.net string collection editor and see the changes in real-time. But when I
run the App, I recieve this error:

Cannot create an object of type 'System.String[]' from its string
representation 'String[] Array' for the 'Options' property.

Even with other types of collections (objects, etc.), I receive this error.
What should I do.

Nov 15 '05 #1
1 3022
Hello,

It seems that either wrong code has been generated by the designer to
initialize the property (posting a generated piece of code would help a
lot), or, if your form is localizable, it might be that the collection
contents cannot be properly deserialized from the resource file.

You may try to employ "real" collections like NameValueCollection or custom
collections inherited from CollectionBase instead of plain arrays.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Unit Testing and Integration Environment
http://x-unity.miik.com.ua
Deliver reliable .NET software

"Hessam" <he********@msn.com> wrote in message
news:uo**************@TK2MSFTNGP12.phx.gbl...
Hello,
I am designing a .net custom control in VS.net 7.1 and my control exposes an array of strings which are supposed to be the items to show. To do this have declared a private string[ ] variable and a public property which returns
it.
string[] options = new string[1];

public string[] Options

{

get

{

return options;

}

set

{

options = value;

}

}

It works fine in the disigner and I can add items to the list using the
VS.net string collection editor and see the changes in real-time. But when I run the App, I recieve this error:

Cannot create an object of type 'System.String[]' from its string
representation 'String[] Array' for the 'Options' property.

Even with other types of collections (objects, etc.), I receive this error. What should I do.


Nov 15 '05 #2

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

Similar topics

3
by: Kakaiya | last post by:
Error message: An unhandled exception of type 'System.InvalidCastException' occurred in test.dll Additional information: Specified cast is not valid. Public Class Form1 Inherits...
0
by: Sundown | last post by:
I am trying to create a custom button control for the web that, when clicked, disables and changes the text of itself and a bunch of other controls (in the collection). My goal is to end up with a...
2
by: Brian | last post by:
NOTE ALSO POSTED IN microsoft.public.dotnet.framework.aspnet.buildingcontrols I have solved most of my Server Control Collection property issues. I wrote an HTML page that describes all of the...
2
by: S. Justin Gengo | last post by:
Hi, I've created a component that allows me to store database information for various types of databases my company uses. It uses a collection for each type of database. Everything is working...
7
by: Supra | last post by:
hi ken tucker, how will i do in vb.net? in vb6 i have no problem. i have rewritten in vb.net but i got white blank form. i am doing irc chat project similar mirc chat. in vb6 class module (not...
3
by: Thief_ | last post by:
I want to store data pertaining to a widget in a collection. The widget has many pproperties, so i created the following class and called it "clsWatchProperties": Public Class clsWatchProperties...
4
by: Michael | last post by:
Dear all .. If I want to use develop a user control and declare a public property which the type is System.Windows.Forms.GridTableStylesCollection For example : Public Class LookAndView...
19
by: Jamey Shuemaker | last post by:
I'm in the process of expanding my knowledge and use of Class Modules. I've perused MSDN and this and other sites, and I'm pretty comfortable with my understanding of Class Modules with the...
3
by: Ross Holder | last post by:
I've created a number of business entities for an applciation I'm working on in ASP.NET (Framework 1.1) and would like to quickly get data into a BoundColumn for a control that consums a...
8
by: Tanzen | last post by:
I'm working in visual studio 2005 trying to learn visual basic. Having come from an VB for Access background, I'm finding it a big learning curve. I have been working through several e-books which...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.