0 ratings 0% found this document useful (0 votes) 29 views 15 pages Visual Basic
The document provides an overview of the different editions of Visual Basic, including the Learning, Professional, and Enterprise editions, each designed for varying levels of programming needs. It details the features and capabilities of each edition, such as data access, ActiveX controls, and project management tools. Additionally, it includes programming fundamentals and sample code snippets for creating basic applications in Visual Basic.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here .
Available Formats
Download as PDF or read online on Scribd
Go to previous items Go to next items
Save Visual Basic For Later nal Bi
Visual Basic is available in three versions, each i
Hesaeianotrbtantaasen geared to meet a specific set of
@ The Visual Basic Learning edition allows programmers to easily powerful
applications for Microsoft Windows °5 and Windows NT. 1 acetyl 1 intrinsic,
controls, plus grid, tab, and data and data-bound controls. Documentation provided with
this edition includes Learn VB Now (a Multimedia CD-ROM title), a printed
Programmer's Guide, onfine Help, pics Visual Basic Books Ontine, It also incorporates a
Fmited subset of the jet engine’s data access capabilities in Data contral and special dats-
bound controls. These features allow you to access existing databases, but do not provide
for creatine new databases or data access objectyy
@ The
Professional edition provides computer professionals with a full-featured set of
tools for developing solution for others. It includes ell the feetures of he Learning
edition, plus addition Active X controls, including Internet Controls, ané
Report Writer. Documentation nrovi
Crystal
includes the
utinble in seeped as either a procedure level
i
Scope Prive a
A eae ep
Procedure cies ae private to | Notappiable we can't
level ‘Seprocetcsiawhich hey | dein public vrble
ser Siti retare
‘Module level module in vic they 7 si
t = Es
1 thin a procedre
‘whine oeedue ee know socal variable, We dcr hes key>
rsa Lal vetles declared with sate, exis the crete
"eS Loca vaables 2 declared wie Dim exists only as Tong 2s
Sestove na oe tit ders nich doa yan soe 8Y
Shove don't supply 2 dat yp, te vaable is given he varias daa 7
32768 1932767
| -aarissssa 92147483687
=019 255
3 Kinds th exesion) Tes ae tbe foudton of any VB sraeson.
2. Brom Medes) asin fe oad is cools sing esae Re
S| <
c)
VB Nee
VAGAC
a
‘ated in VB using tie add-in program the Viswal Date Ma ses
2 used to create a jet database, A jet database is one pear
extension. MDB Microsoft-ACCESS ales Create jet database. Visual Data Manager |
be londed by selecting Add-in from the meme to" ‘and then Visual Data Manager.
NB- * ODBC Detabase — Open Data Base Connectivity.
* ISAM Detabose ~ Indexed Sequential Access Method.
* RDO- Remote ‘Data Object.
* ADO - Activex Data Object.
3 ODBC API — API stand for Application Program Interface,
* DAO — Dara Access Ohjects,
Page No. 11lv
-@ 1. Write a simple program to display a given messaee-
Private Sub Command 1 Click () T
“Text 1.Text = “Welcome uto VB"| _L co
End'Sub
r
é
7
i Private Sub Command2 Click ()
‘Text L-Text = “VB is a 4" Generation language”
End Sub
9 2. Write a simple program to add two numbers.
Private Sub Command 1 Click ()
Dima, b As Integer E a
a= Val (Text I. Text) 2 cc
b= Val (Text 2. Text)
Text3. Text=atb > ann _|
End Sub .
me |{]:
t @. 3. Write a simple program for performing the calculation.
—> Image
+ Timer
Private Sub Command I (Click)
Text3.Text = Val(Text 1-Text) + Val(Te
Label t.Caption=“4° = S
End Sub |
. Private 3b Command? Click (
re a > altText2 2.Text)
Private Sub Comman’ Click{ }
o\(Textl Text) * Val(Text2Fexty—
~_
ub Command Click ( )
= Val(Text 1-Text)/ Vel(Téa 2. Text)
Private Sub Command
Text3.Text= Val(Text
Page No. 12Private Sub Commands Clie 0
Text3.Text = Val(Tont Seat 4 Val(Text2.Text)
Labell Coption =",
End Sub
Private Sub Command? Click()
Textl Text =e
Display.VB
© Val(Text3. Text)
Ifa>b Anda» e Then
MsgBox “Greater no is” & a
Elself b> a And b> ¢ Then
MsgBox “Greater no is” & b
Else
MsgBox “Greater no is” & c
End If,
End Sub
7. WAP to find out the smallest number among three numbers.
Private Sub Command! _Click()
Dima, b,c As Integer
a= Val(Text]. Text)
b= Val(Text2.Text)
c= Val(Text3.Text)
Ifa
Dim a, sura As integer
For n= 1To 20 c
sum sum +n
‘Next oF suM
wenn WYVB
Msgbox “The summation i
End Sub ation
&sum
20. WAP to display the sum of first 20 even numbers.
Private Sub Commandl_Click()
Dim n, sum As Integer
For n= 2 To 40 step 2
sum=sum+ a
Next
Msgbox “ The summation is” & sum
End Sub
21. WAP to display the sum 6f first 20 odd numbers.
Private Sub Commandi_Click()
Dim n, sum As integer
‘or n= 1 To 49 step 2
+R
Else.
‘Msg20°
Endif
xc Sorry f)) No bonus fer u”
» privé Sab Conmmend2_Click()
page No. 17
C| sum
(oe ae
L T
| —_——-
ey | Lo
eC T
Bonus }
E Tr
Gross
c ie
Calevlete | Geer |
|4.
Text! Text =
Text2.Text =“
Text3.Text ="
End Sub
+ 3. WaP to show the result ofa student. ( Pass ot Fail)
Private Sub Command!_Click()
Dim marks As Integer
Marks = Val ( Texti.Text)
Ifmarks>= 30 Then
Text2.Text = “Pass”
Else
Text2.Text = “Feil”
End If
End Sub |
# 24 WAP to display the division of a student.
+ Private Sub Commandl_Click()
Dim sum, avg As Double
‘SUM = Val( Textl. Text) + ‘Vel(Text2. Text) ~ Val (Text3.Text) + Val
Text6.Text = sum
avg=sum /5
‘Text7.Text =. avg.
Have >=70 Th
Text8.Text = “A+”
Elself ave >= 60 Then
Text8.Text = “A”
Elself avg >= 50 Then
‘Text8.Text=“B"
Elec!favg>=40 Then
Text8.Text =“C”
Elself avg >= 30 Then
Text8.Text=“D”
Else :
Text. Text = “Feil” .
Endif --
End Sub
1 Text4.Text) + Val( Text5.Texa
25; WAP to check tha: the entered character is vowel or not,
Private Sub Command)_Ciick() : 3
Dim vowel As Sting
Vowel= Text! Text
t Case vowel +
Case“ar:
Page > 18
i NeCase &:
Case 7:
Ie ae a
‘Private Sub Timer!’
Tahal Visible = Tue
End Sub
_ Page NoiVB
Private Sub Timer2_Timer() : ol
Labell.Visible = False
End Sub
oe Select Commend button >Sty1¢
fa command Lao
between image box:
Picture box captures the area of the box only but image box does not.
pk? WAP to set the font, font style, font colour, font size etc.
‘ FT Brivate Sub Optionl Click ()
If Option! Value = True Then
oO
le > Graphic
Text1.Font = “Comic sans MS”
End If
End Sub_.-
Private Sub Option? Click ()
ICOpton Vator= ive Then
Text1.Font: * Sake
Fed Su oP avi
Private Sub Option3_Click ()
Tf Option3.Valuc = TrieTheéa
‘Textl FontSize mis
EndIf
End Sub
Private Sub Option4_Click ( )
1 Comic Sans Ms
2 Monotype Corsiva
v
1f Option4. Value = True Then
Text! FontSize: § Bola
End if 6 halic
Hai Ny F Undertine
Private Sub OptionS_C1 :
6 Pink
« Bhe
wv Red
WOptionS.Value= True Then, i
Teh Foul Bold = Tyeben te Sep (sot tRe)
4 End Sub
Sib Options _Click()
— Value = True Then Ton)
ext] Fontitlic = Tzu. he>
End le take, (settee
End Sub,
Private Sab Option7_Clisk ()
If Option?.Value = Trae Then
Text FontUndertine =
avi \
A \
\
Private Sub Option Click ¢) y
IOptiond.Vahie = Truc Then i
Text Forecolor = “Blue ( Paste the color code)
EndIf a
End Sub
Private Sub Optioni0_ Click)
If Option10.Valw
True Then “my
Text] Forecolor = 2Red* ( Paste the color code)
Endif :
End Sub