我正在写一个ActiveX控件,我写了如下的属性:--------------------------------------------------------------------dim m_NormalImageList as ObjectPublic Property Get NormalImageList() As Object
Set NormalImageList = m_NormalImageListEnd Property
Public Property Set NormalImageList(ByVal New_NormalImageList As Object)
Set m_NormalImageList = New_NormalImageList
PropertyChanged "NormalImageList"End Property--------------------------------------------------------------------
为了在从设计模式切换到运行模式时保持属性的值,我写了如下事件代码:--------------------------------------------------------------------Private Sub UserControl_WriteProperties(PropBag As PropertyBag) Call PropBag.WriteProperty("NormalImageList", m_NormalImageList, Nothing)
End Sub
Private Sub UserControl_ReadProperties(PropBag As PropertyBag) Set m_NormalImageList = PropBag.ReadProperty("NormalImageList", Nothing)End Sub--------------------------------------------------------------------我觉得一切都合理,可是在我调试的时候,这一句:Call PropBag.WriteProperty("NormalImageList", m_NormalImageList, Nothing)出现了错误:非法的参数。
很郁闷啊,请会这个的朋友指导我一下吧。
Set NormalImageList = m_NormalImageListEnd Property
Public Property Set NormalImageList(ByVal New_NormalImageList As Object)
Set m_NormalImageList = New_NormalImageList
PropertyChanged "NormalImageList"End Property--------------------------------------------------------------------
为了在从设计模式切换到运行模式时保持属性的值,我写了如下事件代码:--------------------------------------------------------------------Private Sub UserControl_WriteProperties(PropBag As PropertyBag) Call PropBag.WriteProperty("NormalImageList", m_NormalImageList, Nothing)
End Sub
Private Sub UserControl_ReadProperties(PropBag As PropertyBag) Set m_NormalImageList = PropBag.ReadProperty("NormalImageList", Nothing)End Sub--------------------------------------------------------------------我觉得一切都合理,可是在我调试的时候,这一句:Call PropBag.WriteProperty("NormalImageList", m_NormalImageList, Nothing)出现了错误:非法的参数。
很郁闷啊,请会这个的朋友指导我一下吧。
Private Function getCtlByName(ByVal CtlName As String)
Dim c As Control
Dim cs As Object
CtlName = UCase(CtlName)
Set cs = Parent.Controls
For Each c In cs
If UCase(c.Name) = CtlName Then
Set getCtlByName = c
Exit For
End If
Next
End Function