On Wed, 23 Nov 2005 18:58:25 +0800, Jason Huang wrote:
Hi,
I am wondering how to use the .Tag in a Windows.Control, such as
MyTextBox.Tag.
Would someone give me some advice?
Thanks for help.
What do you want to use it for? At runtime you can store anything in there
from additional text to a full dataset. Typically I think you'll see it
used to store additional data about what is being displayed in the control.
For example maybe you are showing a person's name in the control, but you
have an complete Person class that you loaded to get that name that
includes additional data such as date of birth, address, etc. You could
store the Person class in the control's Tag property for quick access.
Another usage might be to store a code value and display in the control
descriptive text. An example would be the state portion of a US address.
On the screen you would display Georgia, but you are probably only storing
GA in your backend data store since that is what the US postal service is
going to want. So you set the text to Georgia but hang on to the code of
GA by placing it in the Tag.
These are just two examples. The point is that you can store anything you
want in there.
--
Tom Porterfield