I was looking at a post on vbAccelerator on using a DLL and TLBs to customize the dropdown listing shown on IDE's property sheet for usercontrol properties. The project showed how a typical dropdown might look like the following and can be modified at will
I really liked the idea and thought about a different way of accomplishing the same thing without any ActiveX DLL or TLBs. The attached is my version of vbAccelerator's project.Code:Default Behavior Modified Behavior 0 - vbLeftJustified 0 - Left Aligned 1 - vbRightJustified 1 - Right Aligned 2 - vbCenter 2 - Centered
Note that the methods used allow on-demand, dynamic, "enumerations" that can even be strings vs numerical enumerations. These enumerations are not true enumerations but rather an array of strings that act like enumerations within the property sheet, providing a dropdown list to select from.
For example. Let's say your user control needs to show a listing of available textboxes on the form. In the past, we would have to offer a property page that basically added all the textbox names to a listbox so the user can select one from it. Now, we can provide that list in a dropdown box that will be displayed on the property sheet and no need for a property page just for that purpose.
Anyway, I thought vbAccelerator project was interesting enough to try and replicate it a diffferent way. This is the different way.
Warning. Pretty advanced stuff for such little gain, IMO, but it does present a more "professional" and personal touch to how enumerations are offered to users in design time.
![]()




Reply With Quote