ActiveX Control Tutorial - Part 1
But how can all this background information help in everyday programming life?
Well, with the advent of Visual Basic 5 and, more recently Visual Basic 6, supercool geeky-types have been able to create their very own ActiveX controls.
So perhaps you could create your own groovy text box control that only allows the user to input numbers. Or perhaps just text. Or perhaps text and numbers, but no spaces.
Maybe you'd like to create a company-wide Exit button that flashes every time you hover your mouse over it. Sure, it might be about as useful as a pencil sharpener in the bullring, but it'd look good.
Other slightly more practical uses include creating a standardised Save dialog box. Or a lighter-weight version of the MSChart control. Or a plain but simple replacement for the InputBox() function. Or perhaps an intelligent scrollable window that displays a picture you pass it. Or a new and improved combo box. Or maybe just something else.
Then, when you need to use that groovy flashing Exit button, you simply draw it onto your form, just as you would any standard control. You could then set its MyControl.Forecolor property, and perhaps respond to its MyControl_Click event by adding a bit of code. You could even execute one of its' methods every now and then, such as MyControl.FlashAnimation.
The difference here is that you, as a productive, presentable, professional, pragmatic programmer, created the control. And as such, you dictate when the MyControl_Click event fires. Or how the MyControl.FlashAnimation method works. Or in which way the MyControl.ForeColor property is implemented — is the user presented with a text list of just four colours or the standard colour selection panel?
We'll be covering all this and more in this series. But for now, let's jump in at the deep end and knock out our very first ActiveX control!
Page 3 of 6