The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Windows Forms Quick Tip: Use your Tag property!

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Pau Laudeman

Posts: 54
Nickname: plaudeman
Registered: Apr, 2005

Pau Laudeman is a Smart Client junkie for the .NET platform!
Windows Forms Quick Tip: Use your Tag property! Posted: May 13, 2005 6:29 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Pau Laudeman.
Original Post: Windows Forms Quick Tip: Use your Tag property!
Feed Title: Paul Laudeman
Feed URL: /error.htm?aspxerrorpath=/blogs/paul.laudeman/rss.aspx
Feed Description: Helping You to Make "Smart Clients" Smarter!
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Pau Laudeman
Latest Posts From Paul Laudeman

Advertisement

A question I frequently come across is how to add some type of context information to UI controls in a Windows Forms project. For instance, you might have a textbox where you want to revert to the original value if a user decides to cancel edits, you could store the original value in the Tag property and pull that out when needed (if you're not using data binding). Another example might be if you have a TreeView control and need to add information about the nodes to help perform some action when a user clicks on a node.

In either case, and many more, you should consider using the Tag property of the Control object. As you know, all Windows Forms controls (and even Forms!) inherit from the Control class which offers the Tag property. Since the Tag property is of type Object, this means that you can use it to store anything you want! You could use it to store a string, an array, a full blown class, etc., depending on your needs.

Read: Windows Forms Quick Tip: Use your Tag property!

Topic: Trinity + Artemis Previous Topic   Next Topic Topic: BBC eases rules on news feed use

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use