Link to home
Start Free TrialLog in
Avatar of simonwait
simonwaitFlag for United Kingdom of Great Britain and Northern Ireland

asked on

User Control adopt parent User Controls property

I have a user control called MoveIndicatorCtrl with a user control within it call EnableSideCtrl.  Both have a property called AsNummer.  I would like that when the MoveIndicatorCtrl initializes that it sets the EnableSideCtrls AsNummer property to its own.  I keep trying EnableSideControl.Asnummer = Asnummer but its no good.
Avatar of vb_elmar
vb_elmar
Flag of Germany image

if we have ...
Public Property Let AsNummer(ByVal t As Long)
    AsNummer = t
End Property

... it is not allowed to assign a value to "AsNummer" like this:
Private Sub UserControl_Initialize()
    AsNummer = 2
End Sub
... because (on startup) we'll get an "overflow error" in our .vbp Project.

Instead, we could create a second variable "AsNummer2" and write a value to it :

Public Property Let AsNummer(ByVal t As Long)
    AsNummer2 = t
End Property
UserControl-Initialize--4.zip
ASKER CERTIFIED SOLUTION
Avatar of vb_elmar
vb_elmar
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of simonwait

ASKER

Perfect.  I actually started working with your original solution to then work in the Asnummer2 bit plus a few others but then when accepting I saw your addition.  Thanks very much