Sams Teach Yourself Visual Basic 6 in 24 Hours

Sams Teach Yourself Visual Basic 6 in 24 Hours

By Greg Perry

Q&A

  1. I've always coded long procedures and my programs work, so why should I write structured code now?

    If your way works well, the structured way would be working even better. When you test your applications, you must wade through lots of code, searching for problem areas. When you test structured applications, however, you can usually narrow the bug down to one or two small procedures. Making a change to correct the bug rarely affects other procedures, but when your code is in a few long procedures that do lots of work, a change could adversely affect surrounding code.

  2. If I'm careful, what does it matter how I receive arguments?

    The method you use to pass and receive arguments, either by reference or by value, doesn't just protect data. Sometimes you want a called procedure to change the calling procedure's argument values. A function procedure can only return a single value, but if you want a function procedure to modify several values, pass those values by reference and then make the function procedure (or even the subroutine procedure) modify each of those values. When the calling procedure regains control, the passed arguments will hold values changed by the called procedure.

Share ThisShare This

Informit Network