Professional Documents
Culture Documents
OBJECT:
1All real world enterprises are considered as objects
Eg: Human Being
Components of IDE:
1.Menu Bar
2.Menus
3.Tool Bar
4.Tool Bar controls
5.Tool Box
6.Object Browser
7.Property Window
8.Project Explorer Window
9.Immediate Window
10.Code Window
11.From Layout Window
1. Property window F4
2. Project Explorer Window ctrl + r
3. Form Code Window F7
4. Code Window Form Shift + F7
5. Immediate Window ctrl + g
6. Object Browser F2
7. Run the program F5
VARIABLE:
It is an identifier used to store and manipulate objects
In VB all variables may be declared by means of DIM statement
DIM (dimension statement)
Syntax:
Dim <variable name> as <data type>
Data Type: It is the type of value that the user is going to store
Data Type in VB can be categorized in to7 major types.
Properties: Design Time (static) f4 ii) Run Time Properties (dynamic) (coding)
FORM OBJECT:
Form object has many events out of which important events are as follows:
1Load Event () Triggered when the form is loaded
2Activate Event() Triggered after the Load Event
3Unload Event() Triggered when the form is unloaded
4Terminate Event() Triggered after the unload event
5Click () Triggered when the form is clicked
General:
ASCII a-z 97-122 A-Z 65-90 0-948-57
Extension:
Form .frm
VB Project File .vbp
F4: Text, Name, Appearance 0-flat, Alignment, password char, Multi line, scroll bar
a)Used to get the input from the user.
b)Restricting the user from typing a specific set of keys.
COMBOBOX CONTROL
F4:
Properties:
List used to add items in to the combo.
Style
Run Time:
Methods:
Add Item used to add item in to the combo.
Remove Item used to remove item from the combo based on List Index.
Properties:
List Count used to count the number items in the list.
List Index used to find out the list index. By default list index starts with 0.
List Extract the item from the combo.
Note:
& - called concatenation operator
‘ Remark or non executable or comment line
2) Format Functions
3) String Functions
4) Math Functions
5) Array Functions
Array index will always have 0 as its first index
Array functions can be classified in to 5 major types
i)Array()
ii)L bound () lower bound of an array.
iii)U bound () upper bound of an array.
iv)Join () converts an array in to expression.
v)Split () Converts expression in to an array.
CONTROL ARRAYS:
More than one control of same control type that share the same name with different index
value. Index value starts from 0 to n.
Graphics in VB:
1)Line Method:
Used to draw a line
(x, y)---------------------(x1, y1)
Syntax:
Line(x, y)-(x1, y1), color, bf
2)Circle method:
Used to draw a circle
Syntax:
Circle(x, y), radius, color, xdia, ydia
3)Pset Method:
Used to set or plot points on the form
Syntax:
pset( form width, form height), color
4)Cls Method:
Used to clear the form
TIMER CONTROL:
Common Properties:
Enable Property It will be in inactive state
Visible Property will not appear on the screen
Menu Creation:
Z-Order Method: It is a property available for all the controls for bringing the control back
and forth.
0 Bring to back
1 bring to front
OBJECT LINKING:
One object of an application is linked with another object application.
OBJECT EMBEDDING:
Entire application is embedded in to the current application.
ACTIVEX CONTROL:
Controls that is external to the application which can be used to create custom / user defined
components.
ActiveX controls has no entry point, only the effects alone can be rendered.
ActiveX Controls can be used in the internet also.
In VB these ActiveX controls are termed as “Custom Controls”. Extension (.ocx)
These controls are created in ActiveX Control Project. New Project Dialog ActiveX
Control Project.
In order to load the user defined control in your standard EXE component dialog box the
user should saved it in the following extension “C:\WINNT\SYSTEM32”.(2000 OS)
WIN XP -> C:\WINDOWS\SYSTEM32\.
Converting ActiveX control File
File Make <project name>.ocx
ActiveX Control forms has the extension .ctl
Custom Controls has the extension .ocx
These are the library files that external to your current environment and can be included in
to your application during run time alone.
DLL files are always the procedure / function oriented files (non-visualizable)
These files has the extension .DLL
In Vb It can be created by means of ActiveX Dll project
All DLL project will have class files with extension .cls
To convert DLL project FileMake <projectname>.dll
FILES IN VB 6.0
Files can be categorized in to 2 major types:
1.Sequential Access File
Used to write and read the data sequentially
2.Binary Files:
Reading and writing the data in binary format
9free file used to extract the available free space in the file
10Open used to open the file in specific mode.
Mode: specifies purpose of opening the file
Sequential:
For Reading Input Input
For writing Output write
Binary:
For Reading Binary get
For writing Binary put
Random:
For Reading Random get
For writing Random put
Syntax:
Put #file number, start position, text content
get #file number, start position, text content
Syntax:
Open <filename with path, extension.> For <mode> As <file number>
ACTIVEX Data Object Model Is an Interface to access the data from the database.
It is an Object Model which is Microsoft’s Newest and most powerful paradigm.
To use ADO Objects in code the following reference library should be included.
Project References ActiveX Data Object Library 2.0
1.Connection Object:
Used to establish a connection between front end (vb) and database (back end)
STEPS:
Set the Data Control’s Data Base Name choose the location of your database
Set the Data Control’s Record Source Name choose the table from popping up
Set the Text Box Control’s Data Source choose it as Data1
Set the Text Box Control’s Data Field choose it as field
B
OF
1
2
3
EOF
CREATING PROPERTIES:
Apart from built-in properties available in VB user can also define own properties.
Property should be created as a global so that all forms can be used.
Property should be coded in the module section.
Modules will have the extension *.bas
Project Add Module
Property in VB can be created by means of the following accessor
Syntax:
Let Accessor:
End Property
Get Accessor:
End Property
TYPE Statement:
Used to create records with specified fields
Syntax:
Type <Record name>
Local Variable declaration
End Type
Reports:
c) Detail Section:
All Fields are going to be stored
From the Data Environment choose the fields to be placed on the Detail Section
Select Drag and Drop Click on the detail section out of 2 copies drag one copy and
drop it on the page header section. Drop another copy as it is on the details section.
Data Report1.show