Re: array of objects in a User Control

From: Marina (someone_at_nospam.com)
Date: 10/29/04


Date: Fri, 29 Oct 2004 14:59:57 -0400

I dont' think the designer can serialize it to the array very well, because
it would have to constantly be changing its size. I have done this with
stringcollections, and that works well.

"Vincent Finn" <1@2.com> wrote in message
news:36n4o0tsa1fts3452npg1489cblrekesth@4ax.com...
> Hi,
>
> I am writing a Control (in C#) and I want to give the user access to
> an array of items in it.
> If I make a property that returns the array it doesn't work properly
> in the designer.
>
> The control properties in design mode show my propery
> I can select it
> that brings up a window that allows me to add new items and set their
> properties
> This seems to work and the new items are displayed
> As soon as I compile they vanish.
>
> The array created in the property editor seems to be loaded into
> memory but not saved in the .cs file
>
> I can use the property fine in my code it is just in the property
> window I can't.
>
> Here is the definitions I am using, nothing special about them
>
> Anyone any idea what I am doing wrong?
>
> Vin
>
> /////////////////////////////////////////////////////////
>
> // in the Control
> private Test[] m_aTests;
> public Test[] Tests
> {
> get
> {
> return m_aTests;
> }
> set
> {
> m_aTests = value;
> }
> }
>
> // the class Test
> public class Test
> {
> private int m_i;
> public Test()
> {
> }
> public int i
> {
> get
> {
> return m_i;
> }
> set
> {
> m_i = value;
> }
> }
> }
>



Relevant Pages

  • RE: Problem loading values from class library
    ... and changed all the references to the new location and still the designer ... I just wasted 4 hours chasing a problem because the designer wasn't keeping ... the array of objects and the ComboBox is loaded. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Control Array
    ... Dim tbxArrayAs TextBox ... In VB, I could have a textbox, and have an array of 10, examples ... The designer doesn't support control arrays. ...
    (microsoft.public.dotnet.languages.vb)
  • ComboBox und DataSource
    ... In dieser Form ist eine ComboBox. ... Im Designer setzte dafuer ich ... mit einem Array verknuepfen. ... Welche Bedingungen muessen erfuellt sein, ...
    (microsoft.public.de.german.entwickler.dotnet.csharp)
  • Re: Using a string array as a datasource in a listbox
    ... I have a static class that defines an array and ... > don't want to rebuild it in the designer. ... > manually add the setting of the listbox datasource in code ... > class array to an equivalent hard coded new string array ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: ReadConsoleOutput changes the size of my SMALL_RECT... help!
    ... The problem is probably that ReadConsoleOutput() is expecting to ... write into a 2-dimensional array, ... This will allocate enough space to hold X-rows of Y-columns ... > window displays just fine. ...
    (microsoft.public.vstudio.general)

Loading