I have this code:
VB Code:
  1. Private def_backcolor As OLE_COLOR
  2. Private def_caption As String
  3. Private def_font As StdFont
  4. Private def_forecolor As OLE_COLOR
  5. Private def_selected As Boolean
  6.  
  7. Private color As Long
  8. Private sel As Boolean
  9. Private POINTS(15) As POINTAPI
  10.  
  11. Private Const leftcurve As Double = 0.5
  12. Private Const rightcurve As Double = 0.3
  13.  
  14. Public Property Get BackColor() As OLE_COLOR
  15.     BackColor = color
  16. End Property
  17.  
  18. Public Property Let BackColor(new_color As OLE_COLOR)
  19.     color = new_color
  20.     UserControl.BackColor = RndColor(TranslateColor(new_color))
  21.     UserControl.MaskColor = UserControl.BackColor
  22.     Refresh
  23. End Property
  24.  
  25. Public Property Get Caption() As String
  26.     Caption = lblCaption.Caption
  27. End Property
  28.  
  29. Public Property Let Caption(new_caption As String)
  30.     lblCaption.Caption = new_caption
  31.     Refresh
  32. End Property
  33.  
  34. Public Property Get Font() As StdFont
  35.     Set Font = lblCaption.Font
  36. End Property
  37. Public Property Set Font(new_font As StdFont)
  38.     Set lblCaption.Font = new_font
  39.     Refresh
  40. End Property
  41.  
  42. Public Property Get ForeColor() As OLE_COLOR
  43.     ForeColor = UserControl.ForeColor
  44. End Property
  45. Public Property Let ForeColor(new_color As OLE_COLOR)
  46.     UserControl.ForeColor = new_color
  47.     Refresh
  48. End Property
  49.  
  50. Friend Property Get Selected() As Boolean
  51.     Selected = sel
  52. End Property
  53. Friend Property Let Selected(new_state As Boolean)
  54.     sel = new_state
  55.     Refresh
  56. End Property
  57.  
  58. Private Sub UserControl_InitProperties()
  59.     def_backcolor = UserControl.BackColor
  60.     def_caption = ""
  61.     Set def_font = New StdFont
  62.     def_forecolor = UserControl.ForeColor
  63.     def_selected = False
  64.     'hdc = GetDC(UserControl.parent.hwnd)
  65. End Sub
  66.  
  67. Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
  68.     PropBag.ReadProperty "BackColor", def_backcolor
  69.     PropBag.ReadProperty "Caption", def_caption
  70.     PropBag.ReadProperty "Font", def_font
  71.     PropBag.ReadProperty "ForeColor", def_forecolor
  72.     PropBag.ReadProperty "Selected", def_selected
  73. End Sub
  74.  
  75. Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
  76.     PropBag.WriteProperty "BackColor", UserControl.BackColor, def_backcolor
  77.     PropBag.WriteProperty "Caption", lblCaption.Caption, def_caption
  78.     PropBag.WriteProperty "Font", lblCaption.Font, def_font
  79.     PropBag.WriteProperty "ForeColor", UserControl.ForeColor, def_forecolor
  80.     PropBag.WriteProperty "Selected", sel, def_selected
  81. End Sub
For a usercontrol (pretty obvious hmmm ). Anyway, it doesn't work, for some reason it just doesn't store the data. Everytime I open or run the project it's back to defaults. I am not building the usercontrol in it's own seperate project but in a .exe project. Is that the problem? Is there some workaround?

Many regards in advance,
Xa0z