TAG Property

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • c_shah

    #1

    TAG Property

    Can someone please explain to me the purpose of the tag property for
    WindowsForm controls such as a TEXTBOX? What is the benefit of using
    this
    property if any?

  • Chris Dunaway

    #2
    Re: TAG Property

    It's just a convenient holding place to store some bit of data or
    object that you want to associate with the control.

    Comment

    • zacks@construction-imaging.com

      #3
      Re: TAG Property

      The Tag property is datatype of Object, which means it can be any
      datatype. It's purpose is to allow you to store some information that
      is related to the control it is a property of, and since it is an
      Object, this information can be of any form, a boolean, a string, a
      collection of anything, etc.

      Comment

      • Marina Levit [MVP]

        #4
        Re: TAG Property

        It's there so you can associate arbitrary data with the control. Then,
        whenever you need that piece of information, you can just get the object
        from the Tag property and examine it.

        "c_shah" <shah.chirag@ne tzero.net> wrote in message
        news:1146255139 .047164.30780@y 43g2000cwc.goog legroups.com...[color=blue]
        > Can someone please explain to me the purpose of the tag property for
        > WindowsForm controls such as a TEXTBOX? What is the benefit of using
        > this
        > property if any?
        >[/color]


        Comment

        • Herfried K. Wagner [MVP]

          #5
          Re: TAG Property

          "c_shah" <shah.chirag@ne tzero.net> schrieb:[color=blue]
          > Can someone please explain to me the purpose of the tag property for
          > WindowsForm controls such as a TEXTBOX? What is the benefit of using
          > this
          > property if any?[/color]

          Check out the documentation for 'Control.Tag', which mentions some use
          cases.

          --
          M S Herfried K. Wagner
          M V P <URL:http://dotnet.mvps.org/>
          V B <URL:http://classicvb.org/petition/>

          Comment

          • Martin Milan

            #6
            Re: TAG Property

            zacks@construct ion-imaging.com wrote in
            news:1146255399 .347493.21060@e 56g2000cwe.goog legroups.com:
            [color=blue]
            > The Tag property is datatype of Object, which means it can be any
            > datatype. It's purpose is to allow you to store some information that
            > is related to the control it is a property of, and since it is an
            > Object, this information can be of any form, a boolean, a string, a
            > collection of anything, etc.[/color]

            I'm only just starting to read up on vb.net and c# - work is a vb6
            shop...

            I was under the impression that dotnet controls didn't support the tag
            property - I take either I was wrong, or this has changed?

            Am I really able to use a value type in an object property? I wasn't
            aware that dotnet supported autoboxing either...

            Martin.

            Comment

            • Jay B. Harlow [MVP - Outlook]

              #7
              Re: TAG Property

              Martin,
              | I was under the impression that dotnet controls didn't support the tag
              | property - I take either I was wrong, or this has changed?
              ..NET Windows Forms have supported the Tag property on Control since version
              1.0

              | Am I really able to use a value type in an object property? I wasn't
              | aware that dotnet supported autoboxing either...

              Yes, .NET has always supported autoboxing. However you need to use CType or
              DirectCast to "unbox" if you are using Option Strict On.


              --
              Hope this helps
              Jay B. Harlow [MVP - Outlook]
              ..NET Application Architect, Enthusiast, & Evangelist
              T.S. Bradley - http://www.tsbradley.net


              "Martin Milan" <I8sp@m.i.do> wrote in message
              news:Xns97B4564 47823I8spmido@1 94.117.143.53.. .
              | zacks@construct ion-imaging.com wrote in
              | news:1146255399 .347493.21060@e 56g2000cwe.goog legroups.com:
              |
              | > The Tag property is datatype of Object, which means it can be any
              | > datatype. It's purpose is to allow you to store some information that
              | > is related to the control it is a property of, and since it is an
              | > Object, this information can be of any form, a boolean, a string, a
              | > collection of anything, etc.
              |
              | I'm only just starting to read up on vb.net and c# - work is a vb6
              | shop...
              |
              | I was under the impression that dotnet controls didn't support the tag
              | property - I take either I was wrong, or this has changed?
              |
              | Am I really able to use a value type in an object property? I wasn't
              | aware that dotnet supported autoboxing either...
              |
              | Martin.



              Comment

              • Eric Moreau

                #8
                Re: TAG Property

                > I was under the impression that dotnet controls didn't support the tag[color=blue]
                > property - I take either I was wrong, or this has changed?[/color]

                The first beta of .Net 2002 didn't have it but programmers required it.

                --


                HTH

                Éric Moreau, MCSD, Visual Developer - Visual Basic MVP
                Conseiller Principal / Senior Consultant
                Concept S2i inc. (www.s2i.com)



                Comment

                Working...