LESSON 1b - How to master the interface
Any program can stand to be improved, even mine!
But there's a technique to use when building a bigger and better application - you do it step-by-step.
How to improve the applicationAssuming that you're a beginner with VB, here's the development technique I recommend for you:
Avoid repeating code!In our FootScoreboard example, there is one occasion where there are several lines of code repeated.
OK, so it's only a few lines but, in a large program that can happen a lot and it is very time-consuming both to create the code and the to maintain it.
The way to correct that is to take all the code that repeats and put it into a separate procedure. A procedure is identified by the Private Sub ... End Sub lines.
Then, whenever you have to execute the code, call the procedure simply by writing its name.
A second improvementAnother thing we usually need in a program is a re-initialize button.
After one loop of the program, in this case one match, we usually want to clear all the data and start over.
For that we'll create a Clear button on the form.
But, we'll notice that what we do with the Clear button is in fact the same thing we do when we load the form in the first place. So, we'll use the procedure technique to simplify the code.
To download the improved sample program and study it, click here:
If you haven't found the Visual Basic resource you're looking for,