Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
PropertyBag Problem?
Message
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Title:
PropertyBag Problem?
Miscellaneous
Thread ID:
00783792
Message ID:
00783792
Views:
52
I created an ActiveX control, with a property called Enabled. There is a
label on the control which I want to turn dark grey when the enabled
property is set to False.

The enabled property does not persist from design time into
run time. Here's the code:
Private Const DEF_ENABLED = True
Private bEnabled As Boolean

Private Sub UserControl_Initialize()

  bEnabled = DEF_ENABLED

End Sub

Public Property Get Enabled() As Boolean

  Enabled = bEnabled

End Property

Public Property Let Enabled(ByVal bNewValue As Boolean)

  bEnabled = bNewValue

  If bNewValue Then
    lblCaption.ForeColor = &H80000012
  Else
    lblCaption.ForeColor = &H80000011
  End If

End Property

Private Sub UserControl_ReadProperties(PropBag As PropertyBag)

    bEnabled = PropBag.ReadProperty("Enabled", DEF_ENABLED)

    If bEnabled Then
      lblCaption.ForeColor = &H80000012
    Else
      lblCaption.ForeColor = &H80000011
    End If

End Sub

Private Sub UserControl_WriteProperties(PropBag As PropertyBag)

    Call PropBag.WriteProperty("Enabled", bEnabled, DEF_ENABLED)

End Sub
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Next
Reply
Map
View

Click here to load this message in the networking platform