how to create a custom variable for a Label? RRS feed

  • Question

  • i need my label to store a string variable in it, do you know i can create a custom variable for it.

    i mean for example if it's name is "StoredString" i can access it in my code by "label1.StoredString" just like "Label1.text" or something like that.

    • Moved by Tina-Shi Sunday, February 15, 2015 8:44 AM I did not know the issue is related to which forum
    Saturday, February 7, 2015 12:05 PM


All replies

  • What you need to do is extend the Label class (i.e. make a new class derived from the Label class that includes the new property you want to add).

    Here's an article that describes the procedure:


    • Proposed as answer by Dave PatrickMVP Wednesday, February 18, 2015 1:15 AM
    • Marked as answer by Just Karl Sunday, February 22, 2015 2:48 AM
    Saturday, February 7, 2015 4:08 PM
  • Thanks for pvdg42's help.

    Hi soorena12,

    Based on your issue, I suggest you can try the pvdg42's suggestion check your issue in your side.

    If it still could not help you solve this issue, I suggest you can tell me which kind of application you create the label in the VS IDE?

    What language you use to create for your application?

    If you have any update message about your issue, please tell us.

    Best Regards,

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, February 9, 2015 7:07 AM