
(semi-newbie-ish) More Fun with Fonts..
Since a Font is an object, use Set instead of Let
Quote:
> Public Property Let VariableFont (ByVal inNew As Font)
should be
> Public Property Set VariableFont (ByVal inNew As Font)
> VariableFont = m_VariableFont
should be
> Set VariableFont = m_VariableFont
Also, there's no PropertyChanged call in your Property Let/Set. Without that, you'll only
be able to set properties at runtime (you can do it at design time too... they just won't
be saved)
You may want to fire up the ActiveX Control Interface Wizard add-in. Add/Remove a few
properties/methods/events/etc and look at the code the wizard generates.
--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep it in the groups..
Quote:
> I think I'm going about this the wrong way. I have some code that looks like
> this:
> Dim m_VariableFont As Font
> Dim m_dfVariableFont As New StdFont
> With m_dfVariableFont
> .Name = "Tahoma"
> .Size = 10
> End With
> ...
> ' get/let properties
> Public Property Get VariableFont As Font
> VariableFont = m_VariableFont
> End Property
> Public Property Let VariableFont (ByVal inNew As Font)
> m_VariableFont = inNew
> Call UserControl.Refresh
> End Property
> ...
> ' read/write props
> Private Sub UserControl_ReadProperties(ByRef pBag As PropertyBag)
> Me.VariableFont = pBag.ReadProperty("VariableFont", m_dfVariableFont)
> End Sub
> Private Sub UserControl_WriteProperties(ByRef pBag As PropertyBag)
> Call pBag.WriteProperty("VariableFont", m_VariableFont,
> m_dfVariableFont)
> End Sub
> Every time I attempt to add this control to a form, I get an error on this
> line:
> VariableFont = m_VariableFont
> telling me that an object variable has not been set. Any hints?
> - Marc