Friday, May 21, 2010

Visual Basic: When making an ActiveX control, how do you add comments to properties without using the wizard?

I've made ActiveX controls using the wizard before, but I want to do it without now. How do I add comments which appear in the Properties pane when using the control on a form?

Visual Basic: When making an ActiveX control, how do you add comments to properties without using the wizard?
Hello good question!





Lets say you have a property that gets and sets a variable that is a boolean ( for this example we will introduce a property that checks if the User is in university or not, just a simple bool).





You can do this:





===========================


[Category("My New Category"),


Description("Indicates whether the person is in University"),


DefaultValue(false)]


public bool InUniversity


{


get { return _universityStatus; }


set { _universityStatus = value; }


}


private bool _universityStatus;


===========================





We introduced META tags which will describe this property.


Category: Creates a category subpanel that your component/control property will be visible.


Description: The description of that property will be visible on the bottom as a help (which you need)


DefaultValue: The default value that is active on that properties panel








That is it. Very nice and simple, yet quick way to add description attribute to your public properties.





I hope that helped. Good Luck
Reply:so you want to see the active X's code? did you try importing the active X control using another project?

pollen

No comments:

Post a Comment