Easy question for the experienced developer...

lickuid

Active member
Joined
Nov 6, 2006
Messages
37
Programming Experience
Beginner
Hi,
I'm working on creating my own control, but this question is moreso a general question (I think)
When a developer types a statement such as:

<TypeConverter(GetType(ColourButtonConverter)), DesignTimeVisible(False), ToolboxItem(False)> Public Class ....

I'm looking for an actual explaination as to what this is and what it means... My impression is that between the "<" and ">", a designer would define certain values for the class, function, subroutine, etc... but I'm thinking that the values between the "<>" are relative to design time only... I think my thought process is on the right track but I'd still like to see what you all have to say.
Also, is there a difference between using "<>" before a class definition and using "<>" before a function or sub or porperty?

what is this object called and what is it generally used for?

Thanks all...
 
In vb.net the <> are used with attributes. An attribute can be applied to a property, sub, function or to a class. It's not just at design time that they are used, but a runtime too. The compiler uses these attributes to determine an action to be taken given the attribute.

<TypeConverter(GetType(ColourButtonConverter)), DesignTimeVisible(False), ToolboxItem(False)> Public Class ....

Here several attributes are being applied to a class. The first one 'TypeConverter' is used to specify a custom typeconverter to that class so that at design time the serializers and design time services know how to convert that object to and from a string value so that it can be used in the properties window. DesignTime visible false means that it will not be visible at design time. For example, you know how when you drop a timer onto the designer and it appears in the component tray at the bottom, well with this attribute it won't be displayed. If this attribute wasn't available then every time you add menu items to a menu it would appear in the component tray and it could get very cluttered down there. Toolbox item is fairly straight forward in that it means the object won't appear in the toolbox.
 
Hey, Thanks again vis781! Now I can get back to takling this custom control I'm trying to build based on this tutorial. *whew!
 
Back
Top