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
  1. Home
  2. General Programming
  3. C#
  4. How to reach the (Name) property

How to reach the (Name) property

Scheduled Pinned Locked Moved C#
jsontutorialquestion
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.
  • C Offline
    C Offline
    Calin Macrinici
    wrote on last edited by
    #1

    Hello there! I've been strugling to find a way of obtaining the value of the (Name) property as a string at runtime (you know, the "label1" piece of text that you get when droping a label on your form). I need this to do some custom serialization for a component that doesn't implement any other identification property, and I can't seem to be able to do it. Before I go and extend the component to provide such a property (thus forcing everyone who uses it to type one in), anybody tried to get the (name) property or knows how to do it? Thanks in advance, Calin, Toronto

    T 1 Reply Last reply
    0
    • C Calin Macrinici

      Hello there! I've been strugling to find a way of obtaining the value of the (Name) property as a string at runtime (you know, the "label1" piece of text that you get when droping a label on your form). I need this to do some custom serialization for a component that doesn't implement any other identification property, and I can't seem to be able to do it. Before I go and extend the component to provide such a property (thus forcing everyone who uses it to type one in), anybody tried to get the (name) property or knows how to do it? Thanks in advance, Calin, Toronto

      T Offline
      T Offline
      Tehnoon
      wrote on last edited by
      #2

      If you drag and drop a button with the name button1, you can programmatically access its id or name by using the button1.Name property. It's not that difficult :-);P

      C 1 Reply Last reply
      0
      • T Tehnoon

        If you drag and drop a button with the name button1, you can programmatically access its id or name by using the button1.Name property. It's not that difficult :-);P

        C Offline
        C Offline
        Calin Macrinici
        wrote on last edited by
        #3

        Hi, Tahnoon, and thank you for your reply. As I said in my message, this involves a component (not a control). As we all know, the Name property is a property of the Control class, easily accessible for buttons, labels, etc. However, when you need to access that Name property on a class that doesn't inherit the Control class, thus does not implement the Name property, what do you do? Thank you again, Calin, Toronto

        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