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

Ask a Question related to ASP.NET Building Controls, Design and Development.

  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. Similar Questions and Discussions

    1. Object of type 'System.String' cannot be converted to type 'System
      I'm trying to get a control from metabuilders.com dual list)to work under ASP.NET 2.0. It worked find under 1.1 and then when i migrated my...
    2. Cannot serialize object of type System.Object[,]. Multidimensional arrays are not supported
      Hi, I get this on server when trying to retun a 2 dim array. I apprecaite that they are not supported as per...
    3. Cast from type 'Field' to type 'String'
      Hi, Getting the above error - further info shown below Line 36: II2 = 0 Line 37: response.write ("var questions" & II & " = new Array();"...
    4. How to create an array from a string?
      Hello. I would like to create an array from a string. I tried with: --------------------------- $string = "1 2 3"; @array1 = ; @array2 =...
    5. Cast from type 'DBNull' to type 'String' is not valid error
      Trying to add an insert button Sub btnAddRow_Click event for adding a row to the datagrid and dataset back to SQL. Had it working per the...
  3. #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

  4. #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" <hessammehr@msn.com> wrote in message
    news:OZMmfgYXDHA.1888@TK2MSFTNGP10.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

Posting Permissions

  • You may not post new threads
  • You may 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