Results 1 to 2 of 2

Thread: ReadProperties purpose

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2008
    Posts
    41

    Question ReadProperties purpose

    Hello, im a newbie in this world of OCX programming and i still cant understand whats the purpose of the ReadProperties event and whats the difference between this:

    Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
    TextVariable = PropBag.ReadProperty("Text", "There is no message")
    End Sub

    and this:

    Public Property Get Text() As String
    Text = TextVariable
    End Property

    The ReadProperties event is activated when i read any property or only when i read a particular one?

    I think im lost .

    I hope you can help me.

    Kind regards.

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: ReadProperties purpose

    The ReadProperties event occurs every time a usercontrol in your project has just been created and is first sited on the host container. The InitiProperties event occurs only once and it occurs the very first time the control is dragged onto the container from your toolbox; after that, ReadProperties is called. ReadProperties only occurs once, not for every property. You are expected to retrieve all stored properties and cache them in your code.

    ReadProperties allows you to retrieve previously stored properties that were written in the WriteProperties event. WriteProperties occurs only in design view and what you are writing is basically the properties you exposed as Public that also appear on the property sheet. You can also write custom/internal/personal values if needed. This event only occurs when the control is about to be destroyed (i.e., form closing)

    But I can go on and on regarding the properties and events of usercontrols. Let me give you an excellent link that will help. Specifically, look at Chapter 17.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width