这样就添加了一个属性,名称为aaa. Private taaa As StringPrivate Sub UserControl_ReadProperties(PropBag As PropertyBag) taaa = PropBag.ReadProperty("aaa") End SubPrivate Sub UserControl_WriteProperties(PropBag As PropertyBag) PropBag.WriteProperty "aaa", taaa End SubPublic Property Get aaa() As Variant aaa = taaa End PropertyPublic Property Let aaa(ByVal vNewValue As Variant) taaa = vNewValue End Property
我刚学VB不久,所以请大侠们在回答时请得详细一些,最好带上例子,OK?
在页面里给这个变量的value赋值即可
Private taaa As StringPrivate Sub UserControl_ReadProperties(PropBag As PropertyBag)
taaa = PropBag.ReadProperty("aaa")
End SubPrivate Sub UserControl_WriteProperties(PropBag As PropertyBag)
PropBag.WriteProperty "aaa", taaa
End SubPublic Property Get aaa() As Variant
aaa = taaa
End PropertyPublic Property Let aaa(ByVal vNewValue As Variant)
taaa = vNewValue
End Property
如果属性是对象,则需要用SET语句赋值。