|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
TAG PropertyCan 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? It's just a convenient holding place to store some bit of data or
object that you want to associate with the control. 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. za***@construction-imaging.com wrote in
news:1146255399.347493.21060@e56g2000cwe.googlegroups.com: I'm only just starting to read up on vb.net and c# - work is a vb6> 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. 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. Martin,
| I was under the impression that dotnet controls didn't support the tag ..NET Windows Forms have supported the Tag property on Control since version | property - I take either I was wrong, or this has changed? 1.0 | Am I really able to use a value type in an object property? I wasn't Yes, .NET has always supported autoboxing. However you need to use CType or | aware that dotnet supported autoboxing either... DirectCast to "unbox" if you are using Option Strict On. -- Show quoteHide quoteHope this helps Jay B. Harlow [MVP - Outlook] ..NET Application Architect, Enthusiast, & Evangelist T.S. Bradley - http://www.tsbradley.net "Martin Milan" <I***@m.i.do> wrote in message news:Xns97B456447823I8spmido@194.117.143.53... | za***@construction-imaging.com wrote in | news:1146255399.347493.21060@e56g2000cwe.googlegroups.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. > I was under the impression that dotnet controls didn't support the tag The first beta of .Net 2002 didn't have it but programmers required it.> property - I take either I was wrong, or this has changed? -- HTH Éric Moreau, MCSD, Visual Developer - Visual Basic MVP Conseiller Principal / Senior Consultant Concept S2i inc. (www.s2i.com) http://emoreau.s2i.com/ 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. Show quoteHide quote "c_shah" <shah.chi***@netzero.net> wrote in message news:1146255139.047164.30780@y43g2000cwc.googlegroups.com... > 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? > "c_shah" <shah.chi***@netzero.net> schrieb: Check out the documentation for 'Control.Tag', which mentions some use > 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? cases. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> |
|||||||||||||||||||||||