[dba-VB] Class Tips

Bryan Carbonnell carbonnb at sympatico.ca
Fri Mar 28 19:07:49 CST 2003


On 28 Mar 2003 at 15:08, Francisco H Tapia wrote:

> :-$ hehehe learning new things certainly can make you humble, I
> restepped through your example and it seems I had some variables
> misnamed :D, half working... any idea on how to enable an IsDirty
> property of the CCID so that if I dim a variable
> 
> Dim CC as cMain
> 
> and I modify the data from 1 value to another for the IsDirty property
> to be se to true?  Can't see how that would be done...

Well, the first thing that pops into my head is to create a .Parent 
Property in the CCID class. 

The only problem with that is that you actually have to "tear down" 
the classes before you set them = nothing.

To see how to do that, go to my site 
http://www3.sympatico.ca/carbonnb/bryan/xapp/listvbavars.html 
and download the COM Add-In and look at the source code for it to 
see how to implement a Parent Property.

That being said, It just occurred to me while sticking my daughters 
in the bath, you can raise an event in the CCID class and in your 
main class handle the raised event.

In you Main Class use 

Dim WithEvents mobjCCID as CCID

In your CCID Class in the general Declarations section

Public Event Change()

Then in the Set Value Procedure, after you save the old value and 
set the new value, you would use
RaiseEvents Change

Now back to your main class, and handle the CCID_CHange event. 
In here is where you can set your IsDirty module level variable to 
true.

Make sense?

If not let me know and I'll "enhance" the demo I did this morning.

--
Bryan Carbonnell - carbonnb at sympatico.ca
Experience is a wonderful thing. It enables you to recognize a 
mistake when you make it again.




More information about the dba-VB mailing list