February 28, 2021
Hot Topics:

ActiveX Control Tutorial - Part 3

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

So the wizard has finished whirring and you're sitting there, staring in astonishment/disbelief/annoyance.

Let's take a look at an example of the wizard's work:

'WARNING! DO NOT REMOVE OR MODIFY'THE FOLLOWING COMMENTED LINES!'MappingInfo=txtTextBox,txtTextBox,-1,TextPublic Property Get Text() As String    Text = txtTextBox.TextEnd PropertyPublic Property Let Text(ByVal New_Text As String)    txtTextBox.Text() = New_Text    PropertyChanged "Text"End Property

Hmm, nothing too complex there. In fact, it's almost exactly as we anticipated, except for the 'PropertyChanged' line, but we'll explain that shortly.

Hold on... have you noticed yet? The wizard has commented out the AcceptType and ConvertCase properties you worked so hard to create!

Oh, wait a minute - yep, it's OK - the Wizard has replaced them with almost identical procedures - except the Let procedures now have a 'PropertyChanged' line in them.

Top Tip: As the wizard has now commented out your two procedures, you no longer need the m_CharType and m_CaseType variables you created. The wizard has created it's own variables to hold the values of the AcceptType and ConvertCase properties the more sensibly christened m_AcceptType and m_ConvertCase

What else has that darn wizard done? Oh, it seems there's now code in the WriteProperties and ReadProperties events of the UserControl object. And that code babbles on about 'ReadProperty' and 'WriteProperty'.

Thankfully the code still works, no problems. But tell me Joe, darn it, what's the story with all these here Property thangs?

Well, remember what I mentioned earlier? If you change the properties of your control at design time, then run your project those changes disappear faster than Hitler's wig on a windy day.

That's 'cause we've never told Visual Basic to save them. However the Wizard has now added all this Read/Write Property code that does just that saves or 'persists' our properties.

But that's enough on that topic for now. Go have a good ol' rest and join us next week for the full, feature-length nail-biting explanation!

<Ed: What a cliff hanger!>

Page 5 of 6

This article was originally published on November 21, 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