![]() |
Aggregation Mini-Lecture: Day 3OK, the vet now sees Reptiles and Rodents and wants pet owners informed about Vet Visits, too. Your single class module was getting a bit scary with all those select cases - not a lot better than the original all-the-code-in-the-form way, except for the reusability aspect, eh? You remember reading something in your VB class...something about using multiple classes because classes were really data types, yeah, that's it! Instead of just one class module, you'll use one for each pet type! That should cut down on the confusion a lot. And there's hardly any changes needed to the form code (these are highlighted - the code not shown was not changed and is still there - link opens a new window). The only problem with using that "As Object" is that you can't gain access to the PetCareAdvised event any more. Oh, well, you just moved the reset code into the OK button. You didn't really use the event for anything anyhow...And, yes, the late binding will have a performance implication, but, well, it's a tiny program - can't matter that much...check out these cool new class modules!! (link opens new window) Copy and paste with selected changes is a great thing, isn't it? And those Attentions and VetVisitations properties didn't even require changes (except for the animal)! They are exactly the same in each class (well, except for the animal name) - how's that for cool?...What was that? The vet just called and wants to change the Vet Visits descriptions? And thinks that "made a fuss over" is too general?? More changes??? Ahggg!!! I just hope I remember to change those two in all four classes....if only there were Include statements like I use in Web programming...there is?? Oh, do tell!!!!.... Alrak's Course Resources ©2002-2007 Karla Carter. All rights reserved. This material (including, but not limited to, Mini-lectures and Challenge Labs) may not be reproduced, displayed, modified or distributed without the express prior written permission of the copyright holder. For permission, contact Karla. |