Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Does anyone have a concrete example of the tag use...?

i saw it was about linking data...more...

Auto-suggestion: "I have a life"

Uncontroled thinking: "So what the.."

Posted

Robby, i love Montreal but this was not very useful.

(is the Studebaker still alive?)

Auto-suggestion: "I have a life"

Uncontroled thinking: "So what the.."

Posted

Let me put it this way.

what would be a common use of this prop.

It has to be more than an extra string holder. and what about data link?

Auto-suggestion: "I have a life"

Uncontroled thinking: "So what the.."

Posted

I use the tag property whenever I want to add some extra information to a control but feel to lazy to program an extra new inherited class.

 

E.g. in our application we have control containers that can be prefilled and arranged with special controls at designtime and/or runtime. In order to clean up on a context switch I need to know, which controls where created at runtime, which were created at designtime. I do this by setting the .Tag in the contstructor

 

If not me.DesignTime Then me.Tag = "Created at Runtime"

 

In other cases I have used the tag (on listviewitems) to keep track of the last time that I updated their status (which could result in an icon change).

 

HTH

Heiko

.nerd
Posted

well, that's interesting...

thats right Heiko, since now we can inherit and add any strongly typed property we like to any control, this tag seems a bit obsolete BUT may be a handy "extra string". Never used it myself but I see that I could have...

 

Anyways i saw somewhere the idea of dataset linking with the tag, it aroused my curiosity...if u guys have some insight on this eventually give it a thread...

thx for the input...

 

(Crescent and StCatherine...these were my college wonderyears tag!..I miss it.. gotta go back someday...with my wife this time!!!)

Auto-suggestion: "I have a life"

Uncontroled thinking: "So what the.."

  • Moderators
Posted

"with my wife this time!!!" Are you sure? :)

 

I just thought of something I used the tag for, it was a set of 12 radio buttons, each tag represented a value. I had one event handler for all the radios.

 

So a single line of code did what may have taken a large Select Case.

Visit...Bassic Software
  • *Experts*
Posted

I think the tag is a holdover from VB6 but it can be used for whatever you find necessary. I've used it to hold objects in some rare circumstances. As Robby pointed out, you can now easily create a new class to add a few custom properties to controls.

 

I've put boolean values in a TabPage.Tag (to determine if it's ever been visited), for example...

 

-nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...