I've written hundreds of programs over the years and even though I'm almost perfect ;) a bug or two has managed to show up now and again. Fortunately VB has a good debugger and the following is a tutorial on how to use it.
Using VB6 Debug - Where to Find It and Other Basics
Using VB6 Debug - Descriptions of the Components Part 1
Using VB6 Debug - Descriptions of the Components Part 2
Using VB6 Debug - Descriptions of the Components Part 3