Professional Documents
Culture Documents
Caption Result
Caption
Appearance 0-Flat
text
TextBox 2 Name Txtno2
text
Caption +
Caption -
Caption *
Caption /
Caption CLOSE
Code Window
Assignment 2 : WAP to take input of principal, rate, & time and calculate simple interest & compound interest.
Form Design
Caption
Caption
Appearance 0-Flat
Caption
Appearance 0-Flat
text
text
text
Caption CLOSE
Code Window
Output
Assignment 3 : Write a program to take input of x and print table of x in the following format.
X*1=X
X * 2 = 2X
-----------
-----------
X * 10 = 10*X
Form Design
text
Code Window
Output
Assignment 4 : Design an interface, which will appear like mark sheet . It will take input of marks in five subjects
and calculate total marks and percentage then provide grade according to following criteria. (Using nested if) Use
tab index property to move focus).
If % Then Grade
> = 90 A+
> = 75 & < 90 A
> = 60 & < 75 B
> = 45 & < 60 C
Otherwise F
Form Design
Lblstname
Lblrollno
Lbltmarks
Lblpercent
Lblresult
Lblgrade
Form & main Object Properties
Caption
Caption
Caption
Caption
caption
TabIndex 1
caption
TabIndex 2
caption
TabIndex 3
TabIndex 4
caption
TabIndex 5
caption
TabIndex 6
caption
TabIndex 7
TabIndex 8
Caption Close
TabIndex 9
Code Window
Private Sub cmdclose_Click()
End
End Sub
lblmarks.Caption = total
lblpercent.Caption = percent
Output
MaxButton False
Text
Caption 0
Index 0
Caption 1
Index 1
Caption 2
Index 2
Caption 3
Index 3
Caption 4
Index 4
Caption 5
Index 5
Caption 6
Index 6
Caption 7
Index 7
Caption 8
Index 8
Caption 9
Index 9
Index 10
Caption +
Index 0
Caption -
Index 1
Caption *
Index 2
Caption /
Index 3
Caption C
Caption =
Code Window
Output
Assignment 6 : Write a program to check whether an centered no. is prime or not. (Using for loop & Exit for)
Form Design
Text
Caption
Appearance 0-Flat
Caption Test
Caption Clear
Code Window
If x = 1 Or x = 2 Then
t=0
Else
For y = 2 To (x - 1)
If x Mod y = 0 Then
t=1
Exit For
End If
Next y
End If
If t = 1 Then
lblans.Caption = " It is not a prime number."
Else
lblans.Caption = " It is a prime number."
End If
If x <= 0 Then
txtno.Text = ""
lblans.Caption = ""
End If
End Sub
Output
Assignment 7 : Write a program which will count all vowels, consonants, digits, special characters and blank
spaces in a sentences (Using select case) .
Form Design
Text
Caption
Appearance 0-Flat
Caption
Appearance 0-Flat
Label Name lbldigit
Caption
Appearance 0-Flat
Caption
Appearance 0-Flat
Caption
Appearance 0-Flat
Caption CHECK
Caption Clear
Caption CLOSE
Code Window
Private Sub cmdcheck_Click()
Dim sentence, txt As String
Dim v, c, d, sc, s, l As Integer
sentence = txtsentence.text
l = Len(sentence)
For i = 1 To l
txt = Mid(sentence, i, 1)
Select Case LCase(txt)
Case "a", "e", "i", "o", "u"
v=v+1
Case 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
d=d+1
Case " "
s=s+1
Case "!", "@", "#", "$", "%", "^", "&", "*", "<", ">", "?","/", "\", "-",”,”,”.”
sc = sc + 1
Case Else ' Count Consonants
c=c+1
End Select
Next i
lblvowel.Caption = v
lblconsonant.Caption = c
lbldigit.Caption = d
lblspchar.Caption = sc
lblspace.Caption = s
End Sub
Private Sub cmdclear_Click()
txtsentence.text = ""
lblvowel.Caption = ""
lblconsonant.Caption = ""
lbldigit.Caption = ""
lblspchar.Caption = ""
lblspace.Caption = ""
End Sub
Private Sub cmdclose_Click()
End
End Sub
Output
Form Design
Form & Main Object Properties
Text
Text
Caption ADD
Caption CLEAR
Caption REMOVE
Caption SORT
Caption ADD
Caption REMOVE
Caption SORT
Code Window
Form Design
Text
Caption Bold
Caption Italic
Caption Underline
Code Window
Output
Assignment 10 : WAP for temperature
conversion using option button.
Form Design
Form & Object Properties
Caption
Appearance 0-flat
Caption
Caption Centigrade
Caption Fahrenheit
Code Window
Output
Assignment 11 : WAP to launch a rocket using pictures box and timer control.
Form Design
BoarderStyle 0-None
Interval 0
Enabled False
Code Window
Output
Assignment 12 : WAP to
change back color of any control
(label , textbox) using scroll
box.
Form Design
Form & Object Properties
Caption Red
Caption Green
Caption Blue
Caption Label
Value 0 - Unchecked
Caption Text
Value 0 - Unchecked
Max 255
LargeChange 10
SmallChange 1
Min 0
Max 255
LargeChange 10
SmallChange 1
Min 0
Max 255
LargeChange 10
SmallChange 1
Code Window
Output
Assignment 13 : WAP to search an element for a “one dimension static array”.
Form Design
Caption Search
Code Window
Output
Assignment 14 : WAP to sort a dynamic array of
(a)n numbers
(b)n strings (Input array size at run time)
Form Design
Form & Object Properties
Caption Input items in dynamic array and sort stored items in array and
search any store item .
Caption Numeric
Caption String
Code Window
Output
Assignment 15 : WAP to take input of two
matrices and perform
their addition, subtraction
and multiplication using
menu editor.
Form Design
Form & Object Properties
Caption Addition
Caption Subtraction
Caption Multiplication
Caption Result
Allignment 2-Centre
Label (for Show the Name C
result of matrix create
9 control array of label Caption
name C with index 0 to Appearance 0-Flat
8)
Index 0 to 8
Index 0 to 8
Index 0 to 8
Code Window
End Sub
Output
Assignment 17 : WAP to illustrate call by value and call by reference ( to swap to values)
Form Design
text
Caption
Caption
Appearance 0-Flat
Appearance 0-Flat
Caption
Appearance 0-Flat
Code Window
‘ General Declaration
Sub swapnobyref(ByRef no1 As Integer, ByRef no2 As Integer)
Dim tmpno As Integer
tmpno = no1
no1 = no2
no2 = tmpno
End Sub
______________________________________________________________
‘ General Declaration
Sub swapnobyval(ByVal no1 As Integer, ByVal no2 As Integer)
Dim tmpno As Integer
tmpno = no1
no1 = no2
no2 = tmpno
End Sub
_______________________________________________________
Private Sub cmdbyref_Click()
Dim n1 As Integer
Dim n2 As Integer
n1 = Val(Txtno1.Text)
n2 = Val(Txtno2.Text)
Call swapnobyref(n1, n2)
Lblsno1.Caption = n1
lblsno2.Caption = n2
lblmessage.Caption = "Swapped By Refrence"
End Sub
_________________________________________________________
Private Sub cmdbyval_Click()
Dim n1 As Integer
Dim n2 As Integer
n1 = Val(Txtno1.Text)
n2 = Val(Txtno2.Text)
Call swapnobyval(n1, n2)
Lblsno1.Caption = n1
lblsno2.Caption = n2
lblmessage.Caption = "Swapped By Value"
End Sub
Output
Form Design
text
Caption
Appearance 0-Flat
Code Window
‘ General Declaration
Private Function factorial(no As Integer) As Integer
fact = 1
For n = 1 To no
fact = fact * n
Next n
factorial = fact 'function return value
End Function
______________________________________________________________
Private Sub cmdfact_Click()
Dim x As Integer
x = Val(txtno.Text)
lblno.Caption = factorial(x)
End Sub
Output
Assignment 19 : Take input of a word and WAP to check whether it is a palindrome or not. (Without using
structure fun)
Form Design
Form & Object Properties
text
Code Window
For i = 1 To x
str(i) = Mid(txtstring.Text, i, 1)
Next i
test = True
For j = 1 To UBound(str) / 2
If str(j) <> str((UBound(str) - j) + 1) Then
test = False
End If
Next j
End Sub
Output
Assignment 20 : WAP to find smallest among given three numbers using user defined procedures.
Form Design
text
text
Code Window
‘ General Declaration
Private Sub smallest(a%, b%, c%)
Dim small As Integer
If (a < b) And (a < c) Then
MsgBox ("Smallest Number is " & a)
ElseIf (b < a) And (b < c) Then
MsgBox ("Smallest Number is " & b)
Else
MsgBox ("Smallest Number is " & c)
End If
End Sub
______________________________________________
Private Sub cmdsmall_Click()
Dim x As Integer
Dim y As Integer
Dim z As Integer
x = Val(txtno1.Text)
y = Val(txtno2.Text)
z = Val(txtno3.Text)
Call smallest(x, y, z)
End Sub
Output
Assignment 21 : WAP to generate, print and find sum of first n elements of fibonacci series using recursion.
Form Design
text 2
Appearance 0-Flat
Caption
Code Window
Output
Assignment 22 : WAP to perform read write operations in a sequential file.
Form Design
Form & Object Properties
Caption Name
Text
Text
Text
Multiline true
Scrollbars 3 - Both
Form Design
Caption Name
Caption Class
Text
Text
Text
Text
Multiline true
Scrollbars 3 - Both
Caption Close
Module Code
Note- Add a module from project menu and type the code which show in diagram and save it name with
student1.bas
Output
Assignment 24 : WAP to display records of a table using DAO & bound control code for buttons to move at first
record, next record, previous record, last record in the table.
Form Design
Caption Author ID
DataField Au_ID
DataSource Data1
Text
DataField Author
DataSource Data1
Text
DataSource Data1
Caption Data1
Connect Access
RecordSource Author
Visible False
ReadOnly False
Caption First
Caption next
Caption Previous
Caption last
Code Window
Output
Caption Author ID
Text
DataField Au_ID
DataSource MSRDC1
Text
DataField Author
DataSource MSRDC1
DataSource MSRDC1
Caption MSRDC1
DataSourceName BCA
Visible False
ReadOnly False
Caption First
Caption next
Caption Previous
Caption last
Caption ADD
Caption DELETE
Caption EDIT
Caption EXIT
Note – In this program First we use visual data manager and create new bca1.mdb file in path c:\ and import the
table C:\Program Files\Microsoft Visual Studio\VB98\BIBLIO.MDB then create ODBC system DSN using control
panel administrative tools name BCA with select data C:\bca1.mdb
Code Window
Output
Assignment 26 : WAP to access a database using ADO & display a key column in the combo box or list box
when an item is selected in it, its corresponding records is shown in MSH flex grid.
Form Design
Note : For this program first add new control Microsoft ADO Data Control 6.0 (OLEDB) and Microsoft Hierarchical
FlexGried Control 6.0(OLEDB) from add component and design it on form. Create BCAI, BCAII,BCAIII table in
STUDENT.MDB file using Microsoft Access. After create system DSN name STUDENT and select STUDENT.MDB
file using ODBC in control panel administrative tools .
Database design
Caption Adodc
Visible False
Recordsource
ConnectingString
ComboBox Name cmbclass
Text
AllowUserResizing 3. flexresizeboth
FixedCols 0
FixedRows 1
Datamember
Datasource
Code Window
‘ General Declaration
Dim adoCon As ADODB.Connection
Dim adoRset As ADODB.Recordset
________________________________________
Private Sub cmbclass_Click()
If (cmbclass.Text = "BCA I") Then
Set adoCon = New ADODB.Connection
adoCon.ConnectionTimeout = 30
adoCon.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=STUDENT"
Set adoRset = New ADODB.Recordset
adoRset.Open " BCAI ", adoCon, , , adCmdTable
Set MSHFlesGrid.DataSource = adoRset
End If
Output
Assignment 27 . Using Data Environment create a program to display records of any table..
Form Design
Note : For this program we need Data Environment if it is not available in project menu ,click on project menu
components then click on the Designers tab and select Data Environment.
Database design
For this program we need system DSN name STUDENT using database STUDENT.MDB
Environment Design
Form & Object Properties
Caption First
Name cmdfirst
Caption Next
Name cmdprevious
Caption Previous
Name cmdlast
Caption Last
Name cmdnew
Name cmddelete
ConnectionName Connection1
CursorType 2-adOpenDynamic
LockType 4-adLockBatchOptimistic
Code Window
End Sub
-------------------------------------------------------------------------------
Private Sub cmdprevious_Click()
If DataEnvironment1.rsCommand1.BOF = True Then
MsgBox (" No more recods !. ")
DataEnvironment1.rsCommand1.MoveFirst
Else
DataEnvironment1.rsCommand1.MovePrevious
End If
End Sub
Output
Assignment 28. WAP to generate marksheet of students in a class through data report.
Caption
Datamember Command1
Datasource Dataenvironment1
DataField Rollno
Datamember Command1
Datasource Dataenvironment1
DataField Marks1
Datamember Command1
Datasource Dataenvironment1
DataField Marks2
Datamember Command1
Datasource Dataenvironment1
DataField Marks3
Datamember Command1
Datasource Dataenvironment1
DataField Marks4
Datamember Command1
Datasource Dataenvironment1
DataField Marks5
Datamember Command1
Datasource Dataenvironment1
Text 8 Name Txtmarks
DataField Total
Datamember Command1
Datasource Dataenvironment1
DataField Result
Datamember Command1
Datasource Dataenvironment1
DataField Percent
Datamember Command1
Datasource Dataenvironment1
Caption First
Caption Next
Caption Previous
Caption Last
Caption Add
Caption Delete
Report Design
Report property
DataSource Command1
Datamember Dataenvironment1
Database design
Note : Create system DSN Name BCAMARKS and select student.mdb MS-Access file. Design Dataenvironment1 add
command1 using BCAMARKS and student.mdb file then select table marks. Drag and drop command1 on the
datareport1 form and set according to given in datareport1.
Code Window
Output
Assignment 29. WAP to illustrate various key board and mouse events.
Form & Object Properties
Caption
Backcolor &H80000003&
Caption
Caption
Code Window
Output
Caption
Stretch True
Code Window
Output
Assignment 31. Using toolbar design an interface for string manipulation. Toolbar should have tabs to (a) Find
length of string (b) No of blank spaces in sting (c) Reverse the string Also show current date &
time in status bar.
Note: First we add new component Microsoft Windows Common Control 6.0(SP6) in toolbar
Caption
Appearance 0 - Flat
Text
Toolbar Property
Statusbar Property
Code Window
‘General Declaration
Dim x As Integer
Dim str() As String
Case "k1"
lbl1.Caption = "Length of string"
x = Val(Len(txtstring.Text))
lblans.Caption = x
Case "k2"
lbl1.Caption = "Blank Spaces"
y=0
ReDim str(x) As String
For i = 1 To x
str(i) = Mid(txtstring.Text, i, 1)
If str(i) = " " Then
y=y+1
End If
Next i
lblans.Caption = y
Case "k3"
lbl1.Caption = "Reverse String"
lblans.Caption = StrReverse(txtstring.Text)
End Select
End Sub
Output