VB Basics

 

Start New Project

            Start VB,  Choose “New Project”

 

Put Controls on Forms

            Click on item in tool box

·         Grouping controls such as Group Box or Tab Control

·         Label

·         Text Box

·         Check Box

·         Radio Button 

·         Combo Box

·         List Box

·         Date Time Picker

·         Numeric Up Down (“spinner”)

·         etc

            Click and drag to show position on form

 

Set Properties for Control

Select a control, and find the properties panel. Find the property you care about (e.g. Font) and set the value you want.

 

Align Controls on Form

Multiselect items to be aligned, then Format > Align >   then whatever alignment is desired (e.g. Tops)

 

Associating Code with control

            VB is a full purpose programming language with all kinds of programming constructs. For prototyping, mostly we want to be able to change properties and make things visible and invisible – smoke and mirrors. Many properties of a control can be changed as the program runs by simple commands in code. We will associate code with controls by double clicking on the control, and then in the window brought up, type the code statements in. E.g.s

Make another form visible:

            Formname.Visible = True

me.Visible = False             (makes current form invisible)

            Make a text box visible and place the cursor in it:

textboxcontrolname.Visible = True

textboxcontrolname.Focus( )

Fill possible values in a combobox without getting them from a database or other real data:

comboboxname.Items.Add( "Bryan")

comboboxname. Items.Add( "Mike")

comboboxname. Items.Add( "Susan")

comboboxname.SelectedIndex = 0 ‘ defaults to first item being selected (& it shows)

 

Creating Menus

Use Menu Strip (under All Windows Forms rather than under Common Controls)

            Type in Choices and sub choices etc