Re: When and where do I do Set m_FormVar = Nothing?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"MM" <kylix_is@xxxxxxxxxxx> wrote in message
news:06ri251844s82d5amqmhjl26kqskvgtt4b@xxxxxxxxxx

Question: What kind of code absolutely HAS to appear in
Form_Initialize and nowhere else?

Similarly, what kind of code absolutely HAS to appear in
Form_Terminate and nowhere else?


For a Form No code absolutely HAS to appear in _Initialize or _Terminate and
nowhere else. Except perhaps some debug routine to report a class has
initialized. or terminated.

Of course one should never say never, it might be possible to come up with
something that works better there with some kind of forced flow control, but
it is just as likely you could turn around and port that code into
_Load/_Unload and get the same results.

You will even find some 'experts' suggest that you never use them. Their
reason - if they fail, they do so with little reporting back to the program.
Not that you can't - just you are limited.

For Classes (and for Forms), put anything there to set up the Class data
(members) that has to be there before the Client touches the class, that has
a limited ability to fail. But even there - you are limited. You cannot
receive outside arguments and you can't fail graciously. Best to provide
your own _Init/_Open or _Destroy/_Close methods. They can take arguments,
return arguments, and report errors back.

-ralph


.



Relevant Pages

  • Re: Yet again - closing a thread
    ... then the Wait will not fail. ... changed in such a way that you can no longer reason correctly about its ... and it would be reasonable to terminate your program right then ... You might instead throw an exception. ...
    (microsoft.public.vc.mfc)
  • Re: Playboy, December 2005
    ... buyers that makes it a criminal act of omission to fail to report a ...
    (rec.guns)
  • Re: Old gits & stbs
    ... I make a big effort to avoid jargon, I assume zero knowledge, and I try the whole thing out on a selection of battery idiots that I keep in humane conditions. ... I went through the report and I honestly couldn't find any way to make it more comprehensible. ... will fail to understand it. ...
    (uk.tech.digital-tv)
  • Re: Wait a cycle after resetting MIL before inspection?
    ... around 100 miles and I will fail because of that. ... Does NJ put the car on a dyno or do they just plug it into a scanner? ... you'll fail if the monitors are not all reported "ready". ... monitors to report "ready". ...
    (rec.autos.tech)
  • Re: Obama promised change but picking insiders
    ... to top posts. ... Ho hum. ... What you fail to report is that his choices have received ...
    (soc.retirement)