Working with Forms in Visual Basic The main

Working with Forms in Visual Basic

• The main characteristic of a Form is the title bar

CONTROL MENU • Restore : Restores a maximized Form to the size it was before it was maximized; available only if the Form has been maximized. • Move : Lets the user moves the Form around with the mouse • Size : Lets the user resizes the control with the mouse • Minimize: Minimizes the Form • Maximize : Maximizes the Form • Close : Closes the Form

Loading and Unloading Forms • Load and Unload statements in VB • Load Form. Name • Unload Form. Name

Showing and Hiding Forms • Show method is used to Show a Form • Form. Name. Show • The Hide method is used to hide a Form • Me. Hide • Me is the form name, Keyword

OBJECT Form Label PROPERTY SETTING Caption Name Form 1 frm 1 Form 2 frm 2 Form 3 frm 3 Click on a button to display a Form Label 1 Caption Name


Variables

Variables • Variables are the memory locations which are used to store values temporarily. • Rules • A variable name must begin with an alphabet letter and should not exceed 255 characters. • It must be unique within the same scope. • It should not contain any special character like %, &, !, #, @ or $.
![Syntax • Dim variable [As Type] • Dim I as integer • Dim int. Syntax • Dim variable [As Type] • Dim I as integer • Dim int.](http://slidetodoc.com/presentation_image_h2/5faf64dc5a6133caa1c43b7528eeb2c4/image-10.jpg)
Syntax • Dim variable [As Type] • Dim I as integer • Dim int. Interest. Rate As Integer = 10

Scope of variables • A variable is scoped to • procedure-level (local) -Global • module-level – Local • They can be declared with Dim and Static keywords.

Local Variables • A local variable is one that is declared inside a procedure. • Dim sum As Integer • The local variables exist as long as the procedure in which they are declared, is executing.

Static Variables • A static variable is declared as given below. • Static int. Permanent As Integer • Variables have a lifetime in addition to scope.

DATATYPES • Numeric Data Types • Non-numeric Data Types • Suffixes for Literals
- Slides: 14