Getting to know the VB6 IDE

Level:
Level1

The VB6 IDE (Integrated Development Environment) is a very simple and fully featured IDE. If you start out programming in VB6 you may end up being too spoiled to ever appreciate a more complicated and less functional IDE like most C++ IDEs. One feature which sets VB6 apart from various IDEs is the simplicity of its approach to GUI (Graphical User Interface) design.

As a general rule: Play with it. You're very unlikely to break anything that matters, so just explore and experiment with the IDE, and you'll learn more.

Creating A Project

  1. Start VB6
  2. When presented with a "New Project" dialog you will usually want to pick "Standard EXE" and press "OK"
  3. You now see the VB6 IDE, which contains an empty form called "Form1". That is your program.

Description of the IDE

  • In the middle of the program is a window which contains another window called "Form1". This is called the GUI designer window. That window inside of there with the title "Form1" is your program.
  • On the left is the toolbox, which stores the pre-made objects you can place in your program. This includes visual items you often see in programs like textboxes, command buttons, checkboxes. It also has the potential to include invisible items like the winsock control, which allows easy access to network communication.
  • On the right is the Object properties pane, which contains all of the properties of the item currently selected in the GUI designer.
  • On the top there is the menu bar.
  • On the top, below the menu bar is the toolbar.

Setting up the IDE

Don't allow sloppiness

  1. Click on Tools->Options
  2. Check "Require Variable Declaration"
  3. Click on the "Environment" tab
  4. Select the option button which says "Prompt to save changes"
  5. Press "OK"

Get rid of silliness

On the bottom-right of the IDE, close the "Form Layout" pane because its pretty much useless.

Access to handy functions

  1. Right-click somewhere on the toolbar and click on "Customize..."
  2. Click on the "Commands" tab
  3. Under "Categories", select "Edit"
  4. Scroll down to about the middle of the "Commands" box until you can see "Indent", "Outdent", "Comment Block", and "Uncomment Block". Drag all of those items to your toolbar, putting them in order, right next to the "Start", "Pause", and "Stop" buttons.
  5. Press "Close"

You can now use these commands by selecting a block of text in your source code then hitting one of these commands to do the specified function on the whole block of code. Handy.

Changing Properties of Objects

If you click on an object on your form, or even the form itself, you gain access to the properties of that item and change them in the properties pane on the right side of the screen.

Using controls

Placing controls on a form

All of the items on the left-hand of the screen, in the toolbox pane, are able to be added to a form like this:

  1. Click on the box representing the control you want in your program
  2. Click the left mouse down on a space on a form, then drag to another spot and release the left mouse button. This sometimes makes the control you selected the same size as you directed, and sometimes objects are a fixed size which you can't modify

Importing extra controls

If you want to use a control which is not included in VB6's "Standard EXE" toolbox of 21 controls, you'll need to import them like this:

  1. Right-click somewhere in the toolbox, and select "Components"
  2. In that window you can select an OCX file which contains controls you can add to your form
  • If the control you're looking for isn't on the list then you can try to find it by clicking "Browse..." and finding the OCX file manually
  • Sometimes OCX files are given the extension DLL when the file is a DLL which includes OCX data inside it

Underlined letters

When you press the Alt button in many programs you're shown little lines underneath certain letters of menu items. If you then press on your keyboard a letter which corresponds to one of the underlined letters then that menu item is selected.

In VB6, to get that functionality all you have to do is place an apersand (&) the letter before the letter you want to be underlined and functional in this way.

This functionality exists in:

  • Primary Menu items
  • Secondary menu items
  • Command buttons
  • More..?

Running A Program

Take a look in the menu item "Run".

You will find that:

  • Pressing "Start" in that menu, pressing the "Play" button, or pressing F5 on your keyboard will run your program
  • Pressing "Break" in that menu, pressing the "Pause" button, or pressing Ctrl+Break on your keyboard will pause your program
    • Allows you to edit your program while you're running it (AWESOME! Spoilage factor here versus every other programming IDE)
  • Pressing "End" in that menu, or pressing the "Stop" button will stop your program

Stopping A Program

When you are done testing your application, you will want to close it. There are several ways to accomplish this.

  • If at all possible you should close your application by pressing the "X" button on the top-right of the window of an application, or using the keystroke Alt+F4. This is a "clean" termination of the program.

The following options should be used only in the case that your program has stalled and you cannot close it by pressing Alt+F4 or the "X" button on the program's window. In all of these options there is a chance of causing a memory leak, which renders some space in your computer's memory unusable until the next time you reboot the computer.

  • If the VB6 IDE is still responsive: Press the "Stop" button located beside the "Play" and "Pause" buttons in the VB6 IDE.
  • If the VB6 IDE is no longer responsive: Press Ctrl+Break to Pause the program's execution.
  • If Ctrl+Break doesn't work: Try to end VB6.exe via the windows task manager.
  • If none of that works: Time to restart the computer and go fix that horrible bug in your program!

Compiling A Program

You must be using a full, retail copy of Visual BASIC. The Learning Edition will not compile to EXE

  • In the VB6 IDE, press File->Make ProjectName.exe, select a location and filename you would like your program to have and VB6 will create that EXE for you simply and very easily.

The process in which source code is converted into EXE is called "compiling", and is far more simplified in VB6 than a language like C++.

In order for your program to run on any given computer, that computer must have all of your program's "dependencies". All programs written in VB6 will require the Visual Basic 6 Runtime Library (msvbvm6.dll). Happily: Windows XP had the VB6 runtime library ever since first release, so if you make a VB6 program with no extra dependencies, it will work on Windows XP.

Prior versions of windows, however, did not come with the VB6 runtime preloaded, and will require it to be installed if it hasn't yet been installed.

If your program requires any extra DLL or OCX files in order to work, those are now dependencies of your program which you will need to supply to anyone you want to send your program to. For maximum portability it is a good idea to rely on functionality you implement in your own program. If you're lucky, you can opt for implementing the CTL source code file from an OCX into your program if the OCX is open-source and was written in VB6.


Getting into the source code

Right-click anywhere on the form called "Form1", and select "View code". Another way to accomplish the same thing is to double-click anywhere on the form.

You should now see the following:

Option Explicit
   
Private Sub Form_Load()
End Sub

This is the current source code behind this form. Your cursor is currently between "Private Sub Form_Load()" and "End Sub" because the object you double-clicked on was a "Form" and the default subroutine for the IDE to bring you to if there is nothing yet coded for that object is "Load()".

You can change which subroutine associated with "Form" you want to look at by clicking somewhere inside the "Form_Load" routine, then selecting one of the options inside the combo-box on the top right of the window you're in.

This function will get you spoiled, quick.

Setting project properties

  • In the top menu click on Project » Project1 Properties

Search through this dialog. Learn its options. Set the values inside.

This gives you a good understanding of the basics of the VB IDE. As you program and learn new things these tips will prove very helpful. If you have any other tips or questions please post them by clicking the Add Comment button below.

This tutorail is released under the GNU Free Documentation License 1.2. The original can be found here.

If you enjoyed this post, subscribe for updates (it's free)

indent and oudent

can anyone tell me how indent and outdent commands do in the source code

indent and oudent

can anyone tell me whats the use of indent and outdent in the source code

VB

GOOD EXPLANATION WITH SPOON FEEDING. EXCELLENT

Tutorial.

Thanks for tutorial, it really helped!

installer vb6

please tell me where can i download VB6 installer, please tell me the URL..
thank you

Thank's

This Tutorial is really best Tutorial in the world. I have Very very Thankful to you.
Thank you very much .

vb project

it was nice

Linking a button to the next form..

We are initiated doing a project on "Quiz" in VB....we need a little help here...
you may provide us links, codes, samples....even entire projects...

thanks...

I have a Question

How do I connect to a newly made table in ms access using vb6?
I already have the code to make a new table using adodb. I need the codes to connet to it after.
Thanks

Nice One

Hee,

This tutorial is really good. I was wondering if you (or anyone here) could explain the basics for connecting a database (access for example) to a vb project. When i search it on Google i only see things like: "i have my database connected, but can't change data". thats not what i need to know right now, since i can't even connect the database itself.

Keep up the good work, and hope you can answer my question.

tutorials

nice one good tutorials keep it up thanks

closing forms in developer

I've looked for this answer and asked people. nobody knows. Pretend you are searching for some text and the search finds your text and opens 20 windows or procedure windows with your located code. Is there an easy automatic way to close those 20 windows all at once or do I have to close them all one at a time? (like I'm doing now)

thanks so much
Bill

great explanation

Plan to learn vb for a long time. have been putting off the same as no time to read books. This is a very useful site. keep up the good wk guys! Will regularly catch up with u as i go thru the tutorials. Great effort. Prima Facie the tutorials seem precise

Nice stuff..

This intro is way better than Microsoft's VB6 Introduction tutorial.Keep it up.And keep it flowing,man.

help

I have don’t no about vb, but I like it, so now I design a project about school attendance by period wise so please give me a code to implement with ms access support file(*.mdb) link now I have it that form how can I send to you that form please help me

This is G.K.Dada Peer (Lab Assistant)
And I am doing Hardware & Network solutions in my town (Anantapur (A.P.))
Please send me your id to send that form’s to you
To my id gkdada67@gmail.com

GREAT WORK

The tutorials in this site is very helpful for every level of programmer,who want to lay their their hand on VB....

tutorials

Thanks for the tutorial
I have some knowledge of VB6 but I got to know more here
Great Work
Well Done for a simple explanation

"Option Explicit" means?

What does "Option Explicit" mean? could I know it?
Thank U!,

Pretty good!

Pretty good!

VB

Really good

very handy! practical!

very handy! practical! interesting! super! cool! easy to understand!
LALALALALALALA!!!!!!
ARGHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
powerful! bloodyfool! wonderful! swimming pool! cucumber!

vb6 tutorial

i actually know a little bit about vb6 because my teacher teaches us this but not that clear to understand some terminologies she uses until i read this tutorial...it is really user friendly specially for the beginner!
thanks a lot it is really a tutorial and it's nice...i really get what i wanted to know!!!

beginner

im very new to vb6 the only other programming language ive learned was html. when it says at the top start vb6 what does that mean?

programming

i also learnt html but found out later that the ideal is to learn it together with css as they are a couple.

i neEd iT

mmcAn you post the function of the environment of the visual basic 6.0

thanks a lot

thanks a lot helpful tutorial for a beginner

great tutorial!!!

After I read thsi tutorial, I feel understanding some idea of VB IDE. However, I think that this tutorial is very great and helpful for me !!! Thanks.

Begginer

Hello everyone,
I feel great to have joined this forum for the first time i rad the articles on VB6 i was really amazed on how are you guys doing this great job of helping all the aspiring programmers like me to learn more on how to create programs, i just hope that this will continue as provided by our almighty Father,
GOD bess to all programmers who have joined in this forum.
More power to the site.

I wanna Know

Hi Every body....

I make Database with VB so, I can't make username & Password when is running program How can u Asist me?

When u send me this program follow pictures that explaines program ?

Best Regards

GOOD & BEST SITE for those who are interested in VB6

I just go through this document but got much knowledge about VB6. Thanks vb6.com team for providing this site for new professionals. THANKS...

beginner

good site i need assistance to be able to write a program to generate the average of 10 scores

NICE

Very simple. I Enjoyed it. Keep up the good work man.

great tutorial

thanks it gave all the basic knowledge of vb 6 and IDE ...

--

thanks!!

Thanks! This is LEsson 1! :)

GREAT! :)

^_^TECHNOLOGIAN^_^

superb basic

short n sweet

very nice

Thank for Solve my problem. This is teach me how to solve the query

Nice Article

Really a good article for a beginner like me.Thanx for putting up such a good information in minimum possible words.

Great!!

You guys are great! Visual Basic 6 will NEVER die! VB.NET is garbage! It is not Basic, never will be Basic, and never will be able to beat Basic.

Thank

thank you for your teaching

janithahewamana@yahoo.com

Basic Tutorial

Thank you for the down to earth approach. This will go a long way in boosting the confidence level of beginners like us. The write up is so nice there is no room for confusion whatsoever. This can only come from a very acomplished and expert person with a real desire to share what he knows. Thnak you a lot. Have a nice day.

Ramanuj Asawa

Basic Tutorial

Thank you for the down to earth approach. This will go a long way in boosting the confidence level of beginners like us. The write up is so nice there is no room for confusion whatsoever. This can only come from a very acomplished and expert person with a real desire to share what he knows. Thnak you a lot. Have a nice day.

Ramanuj Asawa

Great Tutorial

Great tutorial. First step to make us beginners an expert.

Awesome!!!

Awesome explanation of basics and small small things which u wont find anywhere.

Good

Thanks for the good tutorial that you give. Hope that you've also give me a a step by step video tutorial. I've been happy that you've shared your knowledge with us. Thank you.. Email me at beb_vanie11@yahoo.com

great tutorial! i

great tutorial! i

oooh

ooohhh..??

vb

great