In this Linkand this one some VB6 programmers discussed about their favorite VB6 tools,I pick up the mostly-voted and some interesting ones as below:
29 votes
Enable mouse wheel in VB6:
Microsoft:enable the mouse scroll wheel
13 votes + 9 votes (in both links)
MZ Tools: VB6 just isn't installed until you've done this.
Free. Lots of extra tools for the IDE,like "Favorite Procedures" and "Add error routine to prodedure" and lots more.
For VB6,MZ-Tools is a fantastic free add-in. My favorite features are its find feature and its ability to find all callers of a given routine with a click of the button.
10 votes
After installing VB6,I always do these
customisations on Tools-Options.
Switch off Auto Syntax Check on the Editor tab. You don't want message Boxes when you type a Syntax error - you just want the problem line shown in red so you can fix it later.
Switch on Require Variable Declaration on the Editor tab. Don't think,just do it.
Switch off Compile On Demand on the General tab. You want to be told about Syntax errors immediately when you run your code,not just when the dodgy routine actually gets called.
Set Error Trapping to "Break on unhandled errors" on the General tab. Actually,this is a personal preference - but you should select the setting that suits you. Hopefully you've worked out an error handling strategy for the VB6 program?
I have an LCD screen,and the default colours don't work very well,so I change them to lighter ones. I'm also using the Consolas font. Makes my VB6 code look twenty-first century anyway :)
http://www.waakee.com/story/27959.html
Switch off Auto Syntax Check on the Editor tab. You don't want message Boxes when you type a Syntax error - you just want the problem line shown in red so you can fix it later.
Switch on Require Variable Declaration on the Editor tab. Don't think,just do it.
Switch off Compile On Demand on the General tab. You want to be told about Syntax errors immediately when you run your code,not just when the dodgy routine actually gets called.
Set Error Trapping to "Break on unhandled errors" on the General tab. Actually,this is a personal preference - but you should select the setting that suits you. Hopefully you've worked out an error handling strategy for the VB6 program?
I have an LCD screen,and the default colours don't work very well,so I change them to lighter ones. I'm also using the Consolas font. Makes my VB6 code look twenty-first century anyway :)
http://www.waakee.com/story/27959.html
6 votes
Custome Code Templates in VB6
把类文件或者窗体文件或者模块文件存在
C:/Program Files/Microsoft Visual Studio/VB6/Template/Classes
或其他目录里,可以让这些文件作为模板自动出现在VB的对话框里。
I don't know if this is really a "hidden" feature or not,but always thought it was a nice time-saver.
You can create your own custom templates for classes,modules,forms,etc. and make them available in the IDE. For example,I usually like to use strongly-typed
Collection
classes in my VB6 code. So I might want a
FooCollection
that holds
Foo
objects and nothing else,instead of a plain old
Collection
. I don't want to have to reimplement the
Collection
interface every time I need a new strongly-typed
Collection
,so I created a new class template that contained all the boiler-plate
Collection
code. Now whenever I go to add a new class module to my project,my custom
TypedCollection
template is available as an option. Then I just rename the newly-added class
FooCollection
and replace all occurences of "As Object" with "As Foo" (where Foo is the type of object I want to store in the collection) and I'm done.
Keeping with my custom class template example,here's what you do:
a) Open up the IDE and start a new project (I usually just do Standard EXE,because it doesn't really matter what you pick here).
b) Add a new class to the project. This will become your template.
c) Code your template class. Basically just write any boiler-plate code that you would like to be able to reuse in other projects. This is straight VB code,nothing special.
d) When you're finished save your file in your
C:/Program Files/Microsoft Visual Studio/VB6/Template/Classes
folder (Note: the other subfolders,such as
Forms
,etc. are for other kinds of templates). The name of the .cls file minus the extension is what will appear in the IDE,so I normally include spaces in the file name for readability.
e) The next time you open up your IDE and click
Project->Add Class Module
,your template class will appear in the list of available class templates.
5 votes
Design Patterns by the GoF. While it doesn't seem specific for VB6 the fact that most of the patterns are based interface implementation and aggregating objects (as opposed to inheritance) makes it well suited for use with VB6. They talk about this on pages 16 to 18 and sum it up in one statement.
Program to an interface,not an implmentation If there is one thing that VB6 and COM does well is handle interfaces.
+1. Can I also plug the book "
Visual Basic Developer's Guide to UML and Design Patterns" by Griver etc? Explains design patterns in 100% VB6,discussing issues like circular references. Anyone whose main experience is in VB6 might find the gang of four book difficult,I recommend this fine book instead.
4 votes
(1) Change the "
Start in" property on the shortcut that you use to start VB6 to the root of your source code directory. This will save many wasted mouse clicks every time you open a project from within the IDE.
(2) The entire
mvps.org site
here
I recommend Karl Peterson'
One stop source and Randy Birch's
VBnet (which has nothing to do with VB.NET) and
Common Controls Replacement Project.
2 votes
(1) I can't believe no one has yet posted
Bruce McKinney's Hardcore Visual Basic (now hosted on mvps.org)! OK it's a book rather than a piece of software,but it expands to a veritable cornucopia of tools and tips.
(2) The
vbAccelerator website. It has so many great examples and free controls with the full source. The site has not been updates in a few years now,but it still keeps running and I still go back to it when working in VB6.
1 vote
The VB6 IDE doesn't remember your preference for
maximizing the code windows. To start up with the VB6 code windows maximized,set this string registry key:
[HKEY_CURRENT_USER/Software/Microsoft/Visual Basic/6.0]
"MdiMaximized"="1"