General information
Category:
Forms & Form designer
>When I’m writing a form class or a form.scx with custom methods, what is the best practice for referring to the form itself in its method code?
>
>Should you use:
>
>This.PropertyName and This.MethodName()
>
>or
>
>ThisForm.PropertyName and ThisForm.MethodName()
'this' keyword always refers to the current object. In a method the current object is the base -- in the case of a form it is the form; so either thisform or this is equivalent. But if the method is in a class and the class object is added to a container, then this refers to the class object and not the form.
So I use 'thisform' to reference the form and not 'this' in methods (in form methods or object methods) -- this way there is not any ambiguity in which one when reading the code or a mistake in reference.
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only