[AccessD] Building a control class

jwcolby jwcolby at colbyconsulting.com
Tue Mar 3 15:32:14 CST 2009


 >So what are you going to do, give the control class every method and property there is and just go 
"oops!" when one of them doesn't apply?

It's worse than that though.  If you intend to sink events in your class then you MUST dimension the 
control variable WithEvents, and you cannot do that for a generic control object.  Try it and you 
get an immediate compile error stating that "object does not source automation events".

IOW you must:

Dimension WithEvents ctl as combo
Dimension WithEvents ctl as textbox
Dimension WithEvents ctl as tab

Dimension WithEvents ctl as Control is illegal syntax and throws an error as soon as you hit compile.


John W. Colby
www.ColbyConsulting.com


Charlotte Foust wrote:
> Of course it's an object, but it's a generic object in a collection of
> generic objects.  What does a control look like?  A textbox is a control
> but a control isn't automatically a textbox.  So what are you going to
> do, give the control class every method and property there is and just
> go "oops!" when one of them doesn't apply?
> 
> Charlotte Foust 
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart
> McLachlan
> Sent: Tuesday, March 03, 2009 12:40 PM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Building a control class
> 
> But a control  *is* an Object. It's also a Class with it's own set of
> properties and methods.  Otherwise you couldn't do:
> 
> For each ctl in me.controls
> ......
> Next




More information about the AccessD mailing list