PDA

Click to See Complete Forum and Search --> : activex doubts.


shan1
Jan 11th, 2000, 05:29 AM
How to create properties page using the menu item Add - property page.

One more Question!
I have problem in adding the font property to my user control. The font does not change when i change the font property (created by me) in the user control
I hev a textbox text1 in my user control

Public Property Get txtfont() As font
Set txtfont = UserControl.font
End Property

Public Property Set txtfont(ByVal vNewValue As font)
Set UserControl.font = vNewValue
Text1.font = UserControl.font
PropertyChanged "txtfont"
End Property

Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
On Error Resume Next
Set txtfont = PropBag.ReadProperty("txtfont")
End Sub

Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
PropBag.WriteProperty "txtfont", txtfont
End Sub

In the form where i placed my usercontrol
the code i placed is

usercontrol11.txtlabel.name= "wingdings"
it does not work..

JeffSM
Jan 11th, 2000, 06:31 PM
To create a new property Page you use this menu and select the "VB Porperty Page Wizard" and it 'll do the hard code so you'll be able to do a fine code.

The other problem


1) I suggest you to delete this code:

Public Property Get txtfont() As font
Set txtfont = UserControl.font
End Property

Public Property Set txtfont(ByVal vNewValue As font)
Set UserControl.font = vNewValue
Text1.font = UserControl.font
PropertyChanged "txtfont"
End Property

Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
On Error Resume Next
Set txtfont = PropBag.ReadProperty("txtfont")
End Sub

Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
PropBag.WriteProperty "txtfont", txtfont
End Sub


2) With the add-in "ActiveX Control Interface Wizard" create a property called "txtfont" after that in the page wizard called "Set Mapping" you can associate your "txtFont" with a control of you usercontrol.

3) In the Private "Sub UserControl_ReadProperties(PropBag As PropertyBag)"

a) If you have other controls that need receive the
font then set it

Set lblOther = lblMAPPED_CONTROL.font

I guess that this 'll help
I you have any questions, please let me konw

Jefferson