J
jralford
Hi,
I have a main form with a number of controls on it. They are a range
of different customized controls.
There are some properties that belong to all of these controls, such
as XOffset, YOffset etc.
Currently, in order to get this value when for instance, the user
clicks on the control, I need to determine the type of control, then
reference it in the following manner:
int MyOffset;
String WhatType = sender.GetType();
if (WhatType == "WindowsApplication1.ucContType1) then
MyOffset = ((WindowsApplication1.ucConttype1)sender).XOffset
if (WhatType == "WindowsApplication1.ucContType2) then
MyOffset = ((WindowsApplication1.ucConttype2)sender).XOffset
As I am referencing a lot of properties on a lot of occasions, the
code starts to get a little unmanageable, even when putting these
lookups away in functions.
So, my question is, is there a way to access a property that I know
belongs to every one of these different types of controls, without
needing to find out the control type?
Thankyou.
James
I have a main form with a number of controls on it. They are a range
of different customized controls.
There are some properties that belong to all of these controls, such
as XOffset, YOffset etc.
Currently, in order to get this value when for instance, the user
clicks on the control, I need to determine the type of control, then
reference it in the following manner:
int MyOffset;
String WhatType = sender.GetType();
if (WhatType == "WindowsApplication1.ucContType1) then
MyOffset = ((WindowsApplication1.ucConttype1)sender).XOffset
if (WhatType == "WindowsApplication1.ucContType2) then
MyOffset = ((WindowsApplication1.ucConttype2)sender).XOffset
As I am referencing a lot of properties on a lot of occasions, the
code starts to get a little unmanageable, even when putting these
lookups away in functions.
So, my question is, is there a way to access a property that I know
belongs to every one of these different types of controls, without
needing to find out the control type?
Thankyou.
James