> Always run an App in the IDE using [Ctl F5]
> - never just use [F5]
[quoted text clipped - 3 lines]
>
> Steve's tip: ChDir App.Path is also wise
I saw the DefObj A-Z suggestion on this newsgroup some time ago, and it
looked like a great idea. So I put it into each of the 100 or so modules
in my program -- and then found a trap. For example, let's say you write
a function and forget to explicitly give it a type:
Public Function Stuff()
Stuff = "stuff"
End Function
And call it someplace in your program:
MsgBox Stuff
Sure enough, if you call it in the IDE, you'll get an error message. But
the sucker will compile just fine. So if, in your testing, you failed to
call that particular function, the trap is set, and the poor user who
does cause that function to be called in the compiled program will be
rewarded with a program crash.
If you do use the DefObj A-Z idea, I suggest using a compiler switch:
#If InIDE Then
DefObj A-Z
#End If
And then *don't forget* to turn off the compiler switch before compiling
the version you're going to send out into the real world.
Roy Lewallen
J French - 07 Mar 2004 12:07 GMT
>> Always run an App in the IDE using [Ctl F5]
>> - never just use [F5]
[quoted text clipped - 31 lines]
>And then *don't forget* to turn off the compiler switch before compiling
>the version you're going to send out into the real world.
I agree that it is a real pain that the error will not show up in the
compiling,
- but I'm not that keen on sending out code that works differently
from the stuff I've developed
When I started using DefObj A-Z, I went through every Function and
Property manually checking the code
I think that if this really became a problem for me, then I would
write a simple program to identify all Functions and Properties
Randy Birch - 07 Mar 2004 12:31 GMT
I can't repro that (VB6). Following your steps I get error 91 in the IDE
until the Stuff() function is explicitly typed (even As Variant). I suggest
you retry this, but do a start with full compile to run in the IDE.

Signature
Randy Birch
MVP Visual Basic
http://vbnet.mvps.org/
Please respond only to the newsgroups so all can benefit.
: > Always run an App in the IDE using [Ctl F5]
: > - never just use [F5]
[quoted text clipped - 33 lines]
:
: Roy Lewallen
Roy Lewallen - 07 Mar 2004 13:50 GMT
> I can't repro that (VB6). Following your steps I get error 91 in the IDE
> until the Stuff() function is explicitly typed (even As Variant). I suggest
> you retry this, but do a start with full compile to run in the IDE.
Yes, you get an error when calling the function either in the IDE or in
the compiled program. The danger is that if you didn't call the function
during testing, the problem is still in there. It compiles just fine.
Although the programming was careless, there was no error and no problem
*until* the DefObj A-Z statement was added. Adding the statement
*created* an error that didn't previously exist -- and one that remains
hidden unless that particular function was tested either in the IDE or
compiled program. That was my point.
It would probably be fairly safe if you put the DefObj A-Z statement in
each module as you first write the program, because chances are you'll
be exercising each of the functions you create. Or, if the program isn't
too complex, you can check each one as J did. What I did was put the
statements into a working program with about 100 modules and probably
2000 or so functions and subs, so it wasn't practical to try and
manually test each one. So what the DefObj A-Z did for me was to set a
dangerous trap just waiting to spring on a user. I was fortunate to
discover the trap before I released any copies to my customers.
Writing a program to find untyped variables, parameters, and functions
is in my opinion a much safer way to go.
Roy Lewallen
Randy Birch - 07 Mar 2004 14:03 GMT
ah .. "didn't call during testing". I can repro that.

Signature
Randy Birch
MVP Visual Basic
http://vbnet.mvps.org/
Please respond only to the newsgroups so all can benefit.
: > I can't repro that (VB6). Following your steps I get error 91 in the IDE
: > until the Stuff() function is explicitly typed (even As Variant). I suggest
: > you retry this, but do a start with full compile to run in the IDE.