>Fix your bugs - do ask VFP to help you hide them!
Terry,
It sounds like you don't get it. Noboby is asking VFP to hide any bug created by a developer. At the contrary, this request is to avoid a possible behavior created by a bug or an external event that may have created the situation which is call
an ExceptionTake this little piece of code for example:
Try
MySqlExec(myHandle, "Select * from Sometable", "MyCursor")
RaiseEvent(this, "DataArrival", "MyCursor")
Select Count(*) From MyCursor Into Array aMyCount
...
Catch
...
EndTry
The function MySqlExec if not successfull with throw an exception wich i will handle in the catch section. So would it be ok to assume the call to "select count(*)" should be successful? No! Not at this time because if some programmer hook to the dataArrival event and close the cursor MyCursor, VFP will show an "open" dialog box. Dho! Open what? it does not say. And even if it would say, there nothing to open because this cursor comes from an SQL Server database...
What a lot of people in this tread are saying is: code defensively and i agree. So before the call to select count(*) i would add a If Used("MyCursor"), This is just not natural and makes the code less readable.
I would find more natural not adding an if used() line and let an exception to occured, then i can deal with it in the catch section.
That's what exception handling is all about. Code naturally and an prepare for exception at the right place, that is: in the catch section.
Stephane