ActiveX Control Tutorial - Part 1
Let's see what all that hard work has given us.
- Click File, Add Project
- Select 'Standard EXE' and click Open
Now we have two different projects open at the same time; our control and this new Standard EXE thing we've just created.
Let's add our new control to the Standard EXE now.
- Drag out the Flasher control () on your toolbar onto Form1, like this:
Top Tip: If your Flasher control is greyed-out... it means your copy of Visual Basic has been attacked by huge killer bees from the terrifying jungles of Outer Mongolia or you haven't closed the workspace of your control. Hmm, probably the latter actually. Close the workspace and try again!
See how your Option Button appears?
Look in the Properties window. Can you see all the Properties your control already has? A Name property, TabIndex, ToolTipText... and more! These are all assigned by default.
- Add a Command Button to the form
- Place the following code behind it:
The method you've just tapped in is the one we coded!
When we added the 'Public Sub Flash' code, it's automatically turned into one heckuva groovy method!
Try hitting F5 and running your application. Now hit the Command Button! See what happens?
The Option Button should flash for a few seconds... great for highlighting a warning of some sort. But not so great at anything else.
Page 5 of 6