...is inaccessible due to its protection level. ?

Discussion in 'ASP .Net' started by Arjen, Jun 11, 2005.

  1. Arjen

    Arjen Guest

    Hi,

    I have this inside a webusercontrol:
    private string MenuItem = new string[2];

    Inside the .ascx file I do this:
    <%= MenuItem(0) %>

    And I get this error:
    ....is inaccessible due to its protection level

    I have changed private to public and even removed it... I always get the
    same error.

    Can somebody help me?

    Thanks!
     
    Arjen, Jun 11, 2005
    #1
    1. Advertisements

  2. Arjen

    Arjen Guest

    Hmmm, found it with <%= MenuItem[0] %> and public

    Now I get this error when doing this: MenuItem[x] = "";
    Compiler Error Message: CS0200: Property or indexer 'string.this[int]'
    cannot be assigned to -- it is read only
     
    Arjen, Jun 11, 2005
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.