Beruflich Dokumente
Kultur Dokumente
The BASIC language was created by Professors John Kemeny and Thomas Kurtz of Dartmouth College in the mid 1960s Visual basic is a windows programming language that has been developed by Microsoft Corporation Features Vb is user friendly tool It is platform dependent. It is simple and easy to develop GUI application Vb is called as event driven programming. it means that the code does not follow a predetermined path it executes different code sections in response to events It is also called as RAD tool-rapid application development tools. It is also called as IDE integrated development tool. it is basically used to describe the interface and environment where we develop, run, test and debug applications.
. visual basic
projects
forms
objects
Object to describe all the forms and controls that make a program . Properties characteristics such as size, caption, color etc Methods the action that an object can perform Events action recognized by form or control i.e pressing a key, clicking a mouse
Vb provides 9 windows
Object window : it is purely meant for designing purpose Property window : it is used to set the character or name Code window :it is editor where we can write code Project explorer window : it is used to navigate from one form to another form Immediate window : we can execute built in functions and also used to debug
the errors
Data type
Byte
Boolean Integer
no of bytes
1
2 2
range
0 to 255
true/false -32768 to 32767
String
Long Single
Double
Decimal Date
8
14 8 1 Jan 100AD to 31 dec 9999 8 supports 4 decimal points to right and 15 to the left reference to any object 16 bytes for numeric data 22 bytes +Len (string) for character data
Currency
Object Variant
The keyword dim or static are placed before the variable name and data types Dim name as string
The local variables are created and exist only as long as the procedure is executing
Static amt as integer
Static variables are used with in the procedure level and they retain their values even after the procedure has finished executing
Procedures
Vb completely depends on procedures. the code in a vb application lives in a containers called modules. the code within the modules is composed of procedures
2. Function procedure : it may take the parameter and ultimately return the
value
Syntax:
<private|public>function <functionname>(argumentlist) as datatype Statements End function
Let assigning Get returning Setreference 4. Event procedure: it will never return a value. Syntax:
Private sub<controlname>_<procedurename>[argument lists] statements End sub
Message box : it is an alert which draws the attention of the user to work with it Syntax when it is function msgbox(message ,[icon style,title]) eg: n = MsgBox("r u sure?", vbQuestion + vbYesNo,sure) Syntax when it is procedure Msgbox,message,[icon style, title] Eg: MsgBox "welcome to vb programming", vbInformation, "welcome Input box : this is used to input the data i.e by passing messages Syntax Inputbox(prompt message, title of input box])
Conditional Operators
Conditional operators are very powerful tools, they let the VB program compare data values and then decide what action to take, whether to execute a program or terminate the program and etc.
Operator = > < >= <= <> Meaning Equal to More than Less Than More than and equal to Less than and equal to Not Equal to
Logical Operators
Operator And Or Xor Not Meaning Both sides must be true One side or other must be true One side or other must be true but not both Negates truth
3. if condition then statements elseif statements else statements endif 4. select case expressions case value 1 statements case value 2 statements case value 3 statements case else statements end select
while condition statements wend do while condition statements loop do statements loop while condition
do
for <variable>=<starting value> to <end value>[step value] statements next <variable> for each <variable> in <form> if typeof <variable> is <control name> then statements end if next <variable>