March 8, 2021
Hot Topics:

ActiveX Control Tutorial - Part 2

  • By Karl Moore
  • Send Email »
  • More Articles »

Now let's test your control!

  • Click File, Add Project
  • Select 'Standard EXE'
  • From the toolbox, add your control to the form

Click on the control and take a peek at the properties window. Do you see the 'AcceptType' and 'ConvertCase' properties?

If you click on any of our custom designed properties, you should be presented with a combo box enabling you to select any of our defined options!

Try changing the options. Does it work?

Note the numbers next to each option. These are automatically added by Visual Basic.

Now try adding a command button and insert code behind it that changes our two properties in code. Notice that just after you type...

Control.OurProperty = 

... it allows you to select one of our options, making your code much easier to read. Isn't that pleasing!?

Now, using the instructions I gave you last week, set the Standard EXE project as 'startup' then run it, both setting and reading our properties in code.

Did it all work? What happens when you read the properties?

'UserControl1' isn't a very professional name. Why not try changing it to something like 'TextBoxPro' using the techniques we explored last week?

Page 5 of 6

This article was originally published on November 20, 2002

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date