J
Johnny Jörgensen
I've got a control class where I want a special action done after it is
instantiated. So I tried to insert a method call in the components
constructor after the initializecomponent call. Like this:
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
DoMySpecial Stuff()
End Sub
Public Sub DoMySpecialStuff()
If SomePropertyOnWhichTheCodeIsDependent = True then
'Do Stuff
End If
End Sub
But that doesn't work as I want, because of course the constructor and the
initializecomponent is called before the properties are set. So when my code
is run, the properties still have their default values. If it was only ONE
property, I could just call my code in the Property set method, but I've got
around 10 properties that need to be set before calling the code.
How can I assure that all properties have been set before calling my code?
Of course, the property set method is only called by the form designer code
if it is serialized, meaning that it doesn't have it's defaultvalue. So I
can't put code in the property set method to later check if the property is
set, because it might or might not have been called, and even if it hasn't
been called, the property still has the right value.
I hope you understand my problem.
Has anybody got a good idea?
Cheers,
Johnny J.
instantiated. So I tried to insert a method call in the components
constructor after the initializecomponent call. Like this:
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
DoMySpecial Stuff()
End Sub
Public Sub DoMySpecialStuff()
If SomePropertyOnWhichTheCodeIsDependent = True then
'Do Stuff
End If
End Sub
But that doesn't work as I want, because of course the constructor and the
initializecomponent is called before the properties are set. So when my code
is run, the properties still have their default values. If it was only ONE
property, I could just call my code in the Property set method, but I've got
around 10 properties that need to be set before calling the code.
How can I assure that all properties have been set before calling my code?
Of course, the property set method is only called by the form designer code
if it is serialized, meaning that it doesn't have it's defaultvalue. So I
can't put code in the property set method to later check if the property is
set, because it might or might not have been called, and even if it hasn't
been called, the property still has the right value.
I hope you understand my problem.
Has anybody got a good idea?
Cheers,
Johnny J.