ActiveX Control Tutorial - Part 4, Page 5
Hey, wait a minute. I've done nothing but babble on about theory so far. It's time to get physical!
<Karl starts grooving away to a song of the same name, unaware of onlookers. Ten minutes later, after one final dazzling disco floor split, he composes himself then returns to the computer>
Have you used the ADO control before? If you right click on it, then select Properties you'll see a small form that enables you to select various options. It's really just an advanced version of the Properties window.
Lot's of professional components have these 'property pages'. They allow you, as the developer to have much more control over how you can display and allow users to select properties.
That means you can use Tabs, Combo Boxes, TreeViews, Command Buttons - basically anything you can add to a regular form - to brighten up the selection of options.
For the rest of today, I'm going to show you how to create your own property page. My example won't be anything spectacular, but hopefully it will give you a few ideas as to how you can create your own.
So wave goodbye to alphabetically ordered Property window, and say hello to the all-singing, all-dancing property page:
- Open our Super Cool Text Box control project
- Click Project, Add Property Page
You should be presented with a screen allowing you to add a raw property page or use the Property Page Wizard. For now, let's be lazy and go with the Wizard we'll do a little manual work later.
- Select the 'VB Property Page Wizard' and click Open
- Click Next at the introduction
Your screen should now look like this:
Each item in this list will represent one 'tab' when you view the property page of your control. For instance, this control has five different property pages each represented by a tab:
- Uncheck the StandardColor and StandardFont boxes
- Click 'Add' and type: General
- Click OK
Top Tip: Our project will only have one property page, General. But you could have many more as the above screenshot demonstrates!
- Click Next
Note that Visual Basic has already selected a list of 'Available Properties', though sadly not 'AcceptType' or 'ConvertCase'. Don't worry, we'll deal with this later.
- Add all available properties to the 'General' list
- Click Next
- Select No for the Summary Report and click Finish
- After the Wizard has finished, click OK