Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

Comment, Tag

These two properties are there for you when you need them. Both of them let you store any character string you want and use it however you’d like.

Usage

oObject.Comment = cValue
cValue = oObject.Comment
oObject.Tag = cValue
cValue = oObject.Tag

Don’t let the name Tag fool you. It has nothing to do with indexes. It’s a carryover from Visual Basic, where it means a tag like the one you find in your shirt. It’s just a place to put identification information.

We’ve been tempted occasionally to use one of these properties to hold the value of another property temporarily, so we can change it in one method and restore it in another. (Otherwise, we have to add a custom property to the object to hold the value.) We haven’t done it because we’re concerned that someone else might do the same thing and clobber our saved value. The right way to do this is to preserve whatever values you might find in Tag, and append your value to the end of the Tag. Wrap your values in delimiters that (you hope) no one else would duplicate. This is similar to the method FoxPro uses in its generated RI code.

At design-time, both of these properties are limited to 255 characters. However, at runtime they appear to hold unlimited text. (We’ve tested them up to 100,000 characters, far more than we’d ever be likely to store there.)

Example

This.Comment = "This is my whiz-bang fancy spinner sample"

oObject.Tag = oObject.Tag + CHR(13) +"*** Tamar's Add-On ***"+;
              AddOn.Value + "*** EOF Tamar's Add-On ***"+CHR(13)