Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Attributes property

Attributes property

Scheduled Pinned Locked Moved C#
csharphelpdesign
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MyThread
    wrote on last edited by
    #1

    Hi, I am trying to write something like this. m_xyz = m_lbl.Attributes("Name") where m_xyz is bool and m_lbl is Webcontrols label. The above works fine in VB.net but gives me the foll. error with C#; 'System.Web.UI.WebControls.WebControl.Attributes' denotes a 'property' where a 'method' was expected Can you please help me with the above. Thanks.

    R M 2 Replies Last reply
    0
    • M MyThread

      Hi, I am trying to write something like this. m_xyz = m_lbl.Attributes("Name") where m_xyz is bool and m_lbl is Webcontrols label. The above works fine in VB.net but gives me the foll. error with C#; 'System.Web.UI.WebControls.WebControl.Attributes' denotes a 'property' where a 'method' was expected Can you please help me with the above. Thanks.

      R Offline
      R Offline
      Robert Rohde
      wrote on last edited by
      #2

      The syntax for accessing indexers in C# is different: m_xyz = m_lbl.Attributes["Name"];

      1 Reply Last reply
      0
      • M MyThread

        Hi, I am trying to write something like this. m_xyz = m_lbl.Attributes("Name") where m_xyz is bool and m_lbl is Webcontrols label. The above works fine in VB.net but gives me the foll. error with C#; 'System.Web.UI.WebControls.WebControl.Attributes' denotes a 'property' where a 'method' was expected Can you please help me with the above. Thanks.

        M Offline
        M Offline
        MyThread
        wrote on last edited by
        #3

        I found the solution: m_xyz = Convert.ToBoolean(m_lbl.Attributes["Name"]); is error free in C#.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups