Results 1 to 4 of 4

Thread: *RESOLVED* values overridden with defaults

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2002
    Location
    Someplace 'ore the rainbow
    Posts
    392

    *RESOLVED* values overridden with defaults

    I want to set some public values in my ActiveX control I'm creating for defaults. This I can do fine. The user can change the values at design-time just fine, but when the program is run, the defaults take over again (because the initialize event is triggered). How do I set default values that won't override the user's?
    Note: If the user sets the values at run-time it will work fine because it is after the initialize sub is called.

    cjqp
    Last edited by cjqp; Feb 12th, 2004 at 03:14 PM.

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    You need to read and write your property values to a propertybag using the ReadProperties and WriteProperties events...
    VB Code:
    1. Private mText As String
    2.  
    3. Public Property Let Text(ByVal s As String)
    4.     mText = s
    5. End Property
    6. Public Property Get Text() As String
    7.     Text = mText
    8. End Property
    9.  
    10. Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
    11.        
    12.     Me.Text = PropBag.ReadProperty("Text", "")
    13.  
    14. End Sub
    15.  
    16. Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
    17.  
    18.     Call PropBag.WriteProperty("Text", Me.Text, "")
    19.  
    20. End Sub

    See if that makes a difference.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2002
    Location
    Someplace 'ore the rainbow
    Posts
    392
    I can't seem to quite grasp this, even after reading VBs help...do you know of a tutorial?

    cjqp

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2002
    Location
    Someplace 'ore the rainbow
    Posts
    392
    Aha, figured it out, thanks for the help!

    cjqp

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