Professional Web Applications Themes

Cannot create an object of type 'System.String[]' from its representation 'String[] Array' - ASP.NET Building Controls

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 ...

  1. #1

    Default Cannot create an object of type 'System.String[]' from its representation 'String[] Array'

    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.






    Hessam Guest

  2. #2

    Default Cannot create an object of type 'System.String[]' from its representation 'String[] Array'

    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.






    Hessam Guest

  3. #3

    Default Re: Cannot create an object of type 'System.String[]' from its representation 'String[] Array'

    If I remember right, there is kind of bug with exposing array types from
    designer. BTW: don't cross-post

    --
    Teemu Keiski
    MCP, Designer/Developer
    Mansoft tietotekniikka Oy
    [url]http://www.mansoft.fi[/url]

    AspInsiders Member, [url]www.aspinsiders.com[/url]
    ASP.NET Forums Moderator, [url]www.asp.net[/url]
    AspAlliance Columnist, [url]www.aspalliance.com[/url]

    "Hessam" <hessammehrmsn.com> wrote in message
    news:OZMmfgYXDHA.1888TK2MSFTNGP10.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.
    >
    >
    >
    >
    >
    >

    Teemu Keiski Guest

Similar Threads

  1. Object of type 'System.String' cannot be converted to type 'System
    By Robert in forum ASP.NET Building Controls
    Replies: 8
    Last Post: May 17th, 08:45 AM
  2. Replies: 3
    Last Post: September 29th, 03:25 AM
  3. Cast from type 'Field' to type 'String'
    By in forum ASP Database
    Replies: 2
    Last Post: November 11th, 03:18 PM
  4. How to create an array from a string?
    By Francesco Moi in forum PERL Miscellaneous
    Replies: 5
    Last Post: August 16th, 11:32 AM
  5. Cast from type 'DBNull' to type 'String' is not valid error
    By Rob in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: July 28th, 09:11 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139