Académique Documents
Professionnel Documents
Culture Documents
Department of MCA
1
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Else
l=m+1
f=0
End If
Loop
If f = 1 Then
MsgBox "element found"
Else
MsgBox "Element not found"
End If
btn_search.Visible = False
btn_serachanother.Visible = True
End Sub
2
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Design:
3
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
4
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
t=0
Else
el = st(t)
t=t-1
i=t
lst_name.Clear
While (i > 0)
lst_name.AddItem st(i)
i=i-1
Wend
lbl_name.ForeColor = &HC000&
lbl_name.Caption = el & "is poped from stack"
btn_pop.Enabled = True
End If
End Sub
5
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Design:
Controls:
6
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Dim f As Integer
Dim a(10) As Integer
Dim n As Integer
Dim r As Integer
Dim el As Integer
Dim f1 As Integer
Dim t As Integer
7
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
lbl_text.ForeColor = &H8000&
lbl_text.Caption = "Queue is empty"
btn_dequeue.Enabled = False
Else
lst_name.Clear
i=f
'i = (f + 1) Mod n
Do
i = (i + 1) Mod n
lst_name.AddItem a(i)
Loop While (i <> r)
lbl_text.ForeColor = &HFF&
lbl_text.Caption = el & "is deleted from queue"
btn_dequeue.Enabled = True
End If
End Sub
8
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Design:
9
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
10
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Design:
Title: Application to demonstrate the queue operations.
Controls:
11
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
12
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Design:
Title: Application to find factorial of given number using functions.
Controls:
13
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
6. Develop a visual basic application to check the given number in one of the
categories like
i)Strong Number
II) Palindrome
III)Perfect Number
Dim n As Integer
Dim r As Integer
Dim s As Integer
Dim t As Integer
Dim s1 As String
Dim x As Integer
14
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
lbl_result.Caption = n & " - is " & s1
Case 2:
perfect (n)
lbl_result.ForeColor = &HFF00&
lbl_result.Caption = n & " - is " & s1
Case 3:
palindrome (n)
lbl_result.ForeColor = &HFF0000
lbl_result.Caption = n & " - is " & s1
End Select
End Sub
15
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Wend
If s = r Then
s1 = "Palindrome"
Else
s1 = "Not palindrome"
End If
End Function
16
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Private Sub rdo_strong_Click()
x=1
End Sub
17
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
7. Develop a visual basic application for copying the elements from one list
to the other list and vice versa (Note: Implement single element, Multiple
elements transfer from lists).
18
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Set head1 = New node 'object pointer to new node
head1.key = 0 'dummy head
Set curr = head1 'keep head pointer here
For i = 1 To 20 'iterate n times to fill list
Set curr.pnext = New node 'insert new node after current
Set curr = curr.pnext 'set current one = new node
curr.key = i 'set new node key value
Next i
Set curr.pnext = New node 'dummy tail
Set curr = curr.pnext 'move current to dummy tail
curr.key = 0 'set value of dummy tail
Set curr.pnext = curr 'points to itself to identify end
btn_createlist2.Visible = False
Frame1.Visible = True
Dim curr As node 'object pointer to current pos in
Dim i As Integer 'list used in For loop
'CREATE LIST
Set head2 = New node 'object pointer to new node
head2.key = 0 'dummy head
Set curr = head2 'keep head pointer here
For i = 1 To 20 'iterate n times to fill list
Set curr.pnext = New node 'insert new node after current
Set curr = curr.pnext 'set current one = new node
curr.key = i + 20 'set new node key value
Next i
Set curr.pnext = New node 'dummy tail
Set curr = curr.pnext 'move current to dummy tail
curr.key = 0 'set value of dummy tail
Set curr.pnext = curr 'points to itself to identify end
19
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
End Sub
20
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
lst_two.AddItem ("pos-" & j & "----" & templist.key)
Set templist = templist.pnext
Wend
21
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Set node1.pnext = node1
lst_one.Clear
Dim templist As node
Dim j As Integer
j=0
Set templist = head1.pnext
While Not templist.pnext Is templist
j=j+1
lst_one.AddItem ("pos-" & j & "----" & templist.key)
Set templist = templist.pnext
Wend
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
22
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Next i
End If
Frame1.Visible = True
End Sub
End Sub
23
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
'walk list and dump to debug window
Dim strOut As String 'temp var to hold string
Dim curr As node 'object pointer to current node
Set curr = head.pnext 'skip dummy head
While Not curr.pnext Is curr 'walk rest of list to end
strOut = strOut & " " & CStr(curr.key)
Set curr = curr.pnext 'current pointer to next node
Wend
DumpList = strOut 'return string
End Function
Design:
Title: Application to copy elements from one list to another vice versa
Controls:
24
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
25
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
a = txt_res.Text
End Sub
26
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
a1 = r
txt_res.Text = r
Case Else
Txt_res.Text = "unable"
End Select
b = Nan
s = Nan
temp = r
End Sub
27
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Private Sub btn_mc_Click() /// code for button MC
t=0
MsgBox ("memory is cleared")
End Sub
28
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
el = "8"
perform el
End Sub
Design:
Title: Application to implement calculator
Controls:
29
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
30
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
'TM
Line (8677, 0)-(8677, 3000), &HFF&
Line (8677, 3000)-(8850, 2500), &HFF&
Line (8677, 3000)-(8530, 2500), &HFF&
'RM
Line (13900, 6606)-(16400, 6606), &HC000&
Line (13900, 6606)-(14200, 6753), &HC000&
Line (13900, 6606)-(14200, 6433), &HC000&
'BM
Line (8677, 9500)-(8677, 12800), &HFF&
Line (8677, 12800)-(8850, 12500), &HFF&
31
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Line (8677, 12800)-(8530, 12500), &HFF&
'LM
Line (700, 6606)-(4000, 6606), &HC000&
Line (700, 6606)-(900, 6753), &HC000&
Line (700, 6606)-(900, 6433), &HC000&
End Sub
'BM
Line (8677, 9500)-(8677, 12800), &HFFFF&
Line (8677, 12800)-(8850, 12500), &HFFFF&
Line (8677, 12800)-(8530, 12500), &HFFFF&
End If
End If
'&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
If lbl_stop.Visible = True Then
If lbl_stop.ForeColor = &HFF& Then
lbl_stop.ForeColor = &HFFFF&
lbl_stop.ForeColor = &HFFFF&
'RM
Line (13900, 6606)-(16400, 6606), &HFFFF&
Line (13900, 6606)-(14200, 6753), &HFFFF&
Line (13900, 6606)-(14200, 6433), &HFFFF&
Line (700, 6606)-(4000, 6606), &HFFFF&
Line (700, 6606)-(900, 6753), &HFFFF&
Line (700, 6606)-(900, 6433), &HFFFF&
End If
End If
End Sub
32
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Private Sub Timer2_Timer()
Timer1.Interval = 5000
If lbl_stop.Visible = True Then
lbl_stop.Visible = False
lbl_go.Visible = True
'TM
Line (8677, 0)-(8677, 3000), &HC000&
Line (8677, 3000)-(8850, 2500), &HC000&
Line (8677, 3000)-(8530, 2500), &HC000&
Else
lbl_stop.Visible = True
lbl_stop.ForeColor = &HFF&
lbl_stop.ForeColor = &HFF&
lbl_go.Visible = False
'TM
Line (8677, 0)-(8677, 3000), &HFF&
Line (8677, 3000)-(8850, 2500), &HFF&
Line (8677, 3000)-(8530, 2500), &HFF&
End If
If lbl_go.Visible = True Then
lbl_go.Visible = False
lbl_stop.Visible = True
lbl_stop.ForeColor = &HFF&
lbl_stop.ForeColor = &HFF&
Line (700, 6606)-(4000, 6606), &HFF&
Line (700, 6606)-(900, 6753), &HFF&
Line (700, 6606)-(900, 6433), &HFF&
Else
lbl_go.Visible = True
lbl_stop.Visible = False
Line (700, 6606)-(4000, 6606), &HC000&
Line (700, 6606)-(900, 6753), &HC000&
Line (700, 6606)-(900, 6433), &HC000&
End If
If lbl_go.Visible = True Then
lbl_go.Visible = False
lbl_stop.Visible = True
Line (13900, 6606)-(16400, 6606), &HFF&
Line (13900, 6606)-(14200, 6753), &HFF&
Line (13900, 6606)-(14200, 6433), &HFF&
Else
lbl_go.Visible = True
lbl_stop.Visible = False
Line (13900, 6606)-(16400, 6606), &HC000&
Line (13900, 6606)-(14200, 6753), &HC000&
Line (13900, 6606)-(14200, 6433), &HC000&
End If
If lbl_stop.Visible = True Then
33
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
lbl_stop.Visible = False
lbl_go.Visible = True
'BM
Line (8677, 9500)-(8677, 12800), &HC000&
Line (8677, 12800)-(8850, 12500), &HC000&
Line (8677, 12800)-(8530, 12500), &HC000&
Else
lbl_stop.Visible = True
lbl_go.Visible = False
'BM
Line (8677, 9500)-(8677, 12800), &HFF&
Line (8677, 12800)-(8850, 12500), &HFF&
Line (8677, 12800)-(8530, 12500), &HFF&
End If
End Sub
Design:
Title: Application to implement Traffic Signals.
Controls:
34
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
35
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
36
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Private Sub btn_sortlist_Click() /// sorting code
Dim temp1 As node
Dim temp2 As node
Dim curr As node
Dim i As Integer
Dim j As Integer
37
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
lst_list1.Visible = True
btn_createlist.Visible = True
btn_sortlist.Visible = True
btn_exit.Visible = True
btn_readsize.Visible = False
lbl_size.Visible = False
txt_size.Visible = False
lbl_text2.Visible = True
End Sub
Design:
Title: Application to sort the given list of numbers.
Controls:
38
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
39
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
11.Develop a visual basic application to read and print user data by using
Input Box and Message Box.
Dim ename As String
Dim sal As Double
Dim empno As Integer
Dim dept As String
Dim designation As String
Design:
Title: Application to read and print user data by using Input Box and Message
Box.
Controls:
40
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Control Name Caption
Button1 btn_read Read user Details
Button2 btn_display Display User Details
Button3 btn_exit Exit
41
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Form2:
Dim x As Integer
Dim a As Integer
Dim b As Integer
Dim res As Integer
43
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Case 2:
res = a - b
Form4. lbl_res.ForeColor = &HC000&
Form4. lbl_res.Caption = "Integer Subtraction of " & a & "and " & b & "
is " & res
Case 3:
res = a * b
Form4. lbl_res.ForeColor = &HC000&
Form4. lbl_res.Caption = "Integer Multiplication of " & a & "and " & b &
" is " & res
Case 4:
res = a / b
Form4. lbl_res.ForeColor = &HC000&
Form4. lbl_res.Caption = "Integer Division of " & a & "and " & b & " is "
& res
End Select
End Sub
44
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Private Subrdo_add_Click()
x=1
End Sub
Form3:
Dim x As Integer
Dim a As Single
Dim b As Single
Dim res As Single
Private Sub btn_calculate_Click()
a = CDbl(Form1.txt_num1.Text)
b = CDbl(Form1.txt_num2.Text)
Form3.Hide
Form4.Show
Select Case x
Case 1:
res = a + b
Form4. lbl_res.ForeColor = &HC000&
Form4. lbl_res.Caption = " Real Addition of " & a & "and " & b & " is " & res
Case 2:
res = a - b
Form4. lbl_res.ForeColor = &HC000&
Form4. lbl_res.Caption = "Real Subtraction of " & a & "and " & b & " is " & res
Case 3:
res = a * b
Form4. lbl_res.ForeColor = &HC000&
Form4. lbl_res .Caption = "Real Multiplication of " & a & "and " & b & " is " &
res
Case 4:
res = a / b
Form4. lbl_res.ForeColor = &HC000&
Form4. lbl_res.Caption = "Real Division of " & a & "and " & b & " is " & res
End Select
End Sub
45
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Private Subrdo_rdiv_Click()
x=4
End Sub
Form4:
Private Sub btn_back_Click()
Form1.rdo_int.Value = False
Form1.rdo_real.Value = False
Form2.rdo_add.Value = False
Form2.rdo_sub.Value = False
Form2.rdo_mul.Value = False
46
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Form2.rdo_div.Value = False
Form3.rdo_radd.Value = False
Form3.rdo_rsub.Value = False
Form3.rdo_rmul.Value = False
Form3.rdo_rdiv.Value = False
Form1.Show
Form4.Hide
Form1.btn_continue.Visible = True
Form1.btn_exit.Visible = True
End Sub
Design:
Title: Application to implement arthimetic operations.
Controls:
Form1:
47
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Form2:
48
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Form3:
Form4:
49
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
50
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Else
MsgBox ("Not a valid user")
txt_user.Text = ""
txt_password.Text = ""
txt_access.Text = ""
txt_user.SetFocus
End If
Else
MsgBox ("Not a valid user")
txt_user.Text = ""
txt_password.Text = ""
txt_access.Text = ""
txt_user.SetFocus
End If
End Sub
Private Sub btn_nextuser_Click() //// code for next user
rs.Close
txt_user.Text = ""
txt_password.Text = ""
txt_access.Text = ""
txt_user.SetFocus
End Sub
Private Sub Form_Load() /// code for form load
Set env = rdoEnvironments(0)
env.CursorDriver = rdUseOdbc
Set conn = env.OpenConnection(sss, rdodriverprompt, False, "DSN=sss;UID=scott;PWD=tiger;")
End Sub
Private Sub btn_exit _Click()
End
End Sub
Design
Title: Application to display the profile of a valid user
51
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
52
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
14. Develop a visual basic application to read the details of the candiadate using the following
conditions.
i. Read the Name,Father Name,Address,Qualification and respective Percentage and
experience if any.
ii. Candidate may choose any two os types (MAX)
iii. Candiadate may choose any three database (MAX)
iv. Candidate may choose any Five programming languages (MAX)
(Note: No control in the Form will be NULL)
53
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Private Sub btn_continue1_Click()
Frame1.Visible = True
End Sub
54
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
If chk_ssc.value = 1 Then
rs("ssc") = txt_ssc.Text
End If
If chk_inter.value = 1 Then
rs("Inter") = txt_inter.Text
End If
If chk_degree.value = 1 Then
rs("Degree") = txt_degree.Text
End If
If chk_pg.value = 1 Then
rs("Pg") = txt_pg.Text
End If
If chk_exp.value = 1 Then
rs("Exp") = txt_exp.Text
End If
If chk_dbms.value = 1 Then
dc1 = dc1 + 1
assign (chk_dbms.Caption)
End If
If chk_rdbms.value = 1 Then
dc1 = dc1 + 1
55
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
assign (chk_rdbms.Caption)
End If
If chk_sql.value = 1 Then
dc1 = dc1 + 1
assign (chk_sql.Caption)
End If
If chk_msaccess.value = 1 Then
dc1 = dc1 + 1
assign (chk_msaccess.Caption)
End If
If chk_windows.value = 1 Then
os1 = os1 + 1
assign1 (chk_windows.Caption)
End If
If chk_solaris.value = 1 Then
os1 = os1 + 1
assign1 (chk_solaris.Caption)
End If
If chk_unix1.value = 1 Then
os1 = os1 + 1
assign1 (chk_unix1.Caption)
End If
If chk_c.value = 1 Then
pl1 = pl1 + 1
assign2 (chk_c.Caption)
End If
If chk_cplus.value = 1 Then
pl1 = pl1 + 1
assign2 (chk_cplus.Caption)
End If
If chk_java.value = 1 Then
pl1 = pl1 + 1
assign2 (chk_java.Caption)
End If
If chk_dotnet.value = 1 Then
pl1 = pl1 + 1
assign2 (chk_dotnet.Caption)
End If
56
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
If chk_vb.value = 1 Then
pl1 = pl1 + 1
assign2 (chk_vb.Caption)
End If
If chk_html.value = 1 Then
pl1 = pl1 + 1
assign2 (chk_html.Caption)
End If
If chk_unix.value = 1 Then
pl1 = pl1 + 1
assign2 (chk_unix.Caption)
End If
rs.Update
MsgBox ("record loaded successfully")
End If
End Sub
57
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Else
If pl1 = 4 Then
rs("pl4") = s3
Else
rs("pl5") = s3
End If
End If
End If
End If
End Function
58
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
chk_c.value = 0
End If
End Sub
59
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
k=0
Else
langcount = langcount + 1
End If
max
End If
If value = 0 Then
langcount = langcount - 1
End If
checklang = k
End Function
60
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Private Sub chk_exp_Click()
If chk_exp.value = 1 Then
txt_exp.Visible = True
Else
txt_exp.Visible = False
End If
End Sub
61
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
End If
End Sub
End Sub
62
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Private Sub chk_unix1_Click()
Dim v As Integer
v = checkos(chk_unix1.value)
If v = 0 Then
MsgBox v
chk_unix1.value = 0
End If
End Sub
63
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
txt_pg.Visible = False
txt_exp.Visible = False
btn_ok.Visible = False
chk_ssc.Visible = False
chk_inter.Visible = False
chk_degree.Visible = False
chk_pg.Visible = False
chk_exp.Visible = False
btn_exit.Visible = False
btn_continue.Visible = False
End Sub
Design
Title: Application to display the profile of a valid user
Control
64
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Checkbox4 (frame1) chk_pg Pg
Checkbox5(frame1) chk_exp Experience
Label1(Frame2) lbl_os Select OS
Checkbox1(frame2) chk_windows Windows
Checkbox2(frame2) chk_solarsi Solaris
Checkbox3(frame2) chk_unix Unix
Button1(frame2) btn_os OK
Label1(Frame3) lbl_database Select Database
Checkbox1(frame3) chk_dbms DBMS
Checkbox2(frame3) chk_rdbms RDBMS
Checkbox3(frame3) chk_sql Sql Server
Checkbox4(frame3) chk_msaccess Ms Access
Button1(frame3) btn_database OK
Label1(Frame4) lbl_lang Select Languages
Checkbox1(frame4) chk_c C
Checkbox2(frame4) chk_cplus C++
Checkbox3(frame4) chk_java Java
Checkbox4(frame4) chk_vb VB
Checkbox5(frame4) chk_dotnet Dot net
Checkbox6(frame4) chk_html Html
Checkbox7(frame4) chk_unix1l Unix
Button1(frame4) btn_lang Ok
65
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
66
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
15. Develop a visual basic application to make survey on different age groups.
Example:
Age groups may be (25-34), (35-44), (45-54) and >=55 and display the no ofpeople on a
particular age group.
67
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
s1 = "create view v1 as select eno as No,ename as Name,round((sysdate-dob)/365) as
Age from employee"
s2 = "select count(*) no from v1 where age between '" & txt_from.Text & " ' and '" &
txt_to.Text & " ' "
s3 = "drop view v1"
Set rs1 = cn.OpenResultset(s1, rdOpenDynamic, rdConcurRowVer)
Set rs2 = cn.OpenResultset(s2, rdOpenDynamic, rdConcurRowVer)
Set rs3 = cn.OpenResultset(s3, rdOpenDynamic, rdConcurRowVer)
txt_result.Text = rs2("No")
'MsgBox " View Dropped "
End Sub
68
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
group
Textbox1 txt_from
Textbox2 txt_to
Textbox3 txt_result
69
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
16. Develop a visual basic application to make the following database operations by using ADO.
i. Insert new Employee into the database.
ii. Delete an existing employee from the database.
iii. Update the employee information on the basis of employee number.
iv. Serach an employee details on the basis of department number.
70
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Private Sub Delete_Click(Index As Integer)
Form3.Show
End Sub
Form1.code (search)
End Sub
Form2.code (update)
Dim rs As New ADODB.Recordset
Dim s As String
rs("no") = txt_no1.Text
rs("name") = txt_name.Text
rs("job") = txt_job.Text
rs("hiredate") = txt_hiredate.Text
72
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
rs("sal") = txt_sal.Text
rs("deptname") = txt_dept.Text
rs.Update
End If
MsgBox " Employee Updated Successfully...."
btn_update.Visible = False
End Sub
End Sub
Form3.code(delete)
73
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
rs2.Open s2, cn2, adOpenDynamic, adLockPessimistic
MsgBox "Employee Deleted Successfully"
End Sub
End Sub
End Sub
74
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
txt_job.Text = ""
txt_hiredate.Text = ""
txt_sal.Text = ""
txt_dept.Text = ""
rs4.Close
End Sub
End Sub
Design:
Title: Application to perform operation on employee database using ADO.
Controls:
Form1(Search)
Control Name Caption
Button1 btn_empdetails Get Employee Details
Button2 btn_nextemp Next Employee Details
Label1 lbl_no Enter employee number you
want to search
Label2 lbl_no1 Employee Number
Label3 lbl_name Employee name
Label4 lbl_job Job
Label5 lbl_hiredate Employee Hiredate
Labe6 lbl_sal Salary
Label7 lbl_dept Employee Dept name
Textbox1 txt_no
Textbox2 txt_no1
Textbox3 txt_name
Textbox4 txt_job
Textbox5 txt_hiredate
Textbox6 txt_sal
Textbox7 txt_dept
75
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Form2(update)
Control Name Caption
Button1 btn_empdetails Get Employee Details
Button2 btn_update Update Details
Button3 btn_update1 Next Update
Label1 lbl_no Enter employee number you
want to update
Label2 lbl_no1 Employee Number
Label3 lbl_name Employee name
Label4 lbl_job Job
Label5 lbl_hiredate Employee Hiredate
Labe6 lbl_sal Salary
Label7 lbl_dept Employee Dept name
Textbox1 txt_no
Textbox2 txt_no1
Textbox3 txt_name
Textbox4 txt_job
Textbox5 txt_hiredate
Textbox6 txt_sal
Textbox7 txt_dept
76
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Form3(Delete)
Form2(update)
Control Name Caption
Button1 btn_delete Delete Employee
Textbox1 txt_no
Label1 lbl_no Enter employee number you
want to update
Form4(New)
Control Name Caption
Button1 btn_insert Insert Employee
Button2 Btn_nextemp Next employee
Label1 lbl_no1 Employee Number
Label2 lbl_name Employee name
Label3 lbl_job Job
Label4 lbl_hiredate Employee Hiredate
Labe5 lbl_sal Salary
Label6 lbl_dept Employee Dept name
Textbox1 txt_no
77
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
Textbox3 txt_name
Textbox4 txt_job
Textbox5 txt_hiredate
Textbox6 txt_sal
Textbox7 txt_dept
Mdi form
78
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
17. Develop a visual basic application to make the following operations on employee database.
i. Search an employee on the basis of employee number.
ii. Navigate and display the records on MOVE FIRST, MOVE NEXT, MOVE LAST and
MOVE PREVIOUS.
'Move First
79
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
txt_mgr.Text = Rs("mgr")
txt_hiredate.Text = Rs("hiredate")
txt_sal.Text = Rs("sal")
txt_deptno.Text = Rs("deptno")
Else
MsgBox "End of file reached"
End If
btn_next.Enabled = True
End Sub
'Move Previous
Private Sub btn_previous_Click()
Rs.MovePrevious
If Rs.EOF <> True Then
txt_empno.Text = Rs("empno")
txt_ename.Text = Rs("Ename")
txt_job.Text = Rs("job")
txt_mgr.Text = Rs("mgr")
txt_hiredate.Text = Rs("hiredate")
txt_sal.Text = Rs("sal")
txt_deptno.Text = Rs("deptno")
Else
MsgBox "End of file reached"
End If
btn_next.Enabled = True
End Sub
80
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
MsgBox "End of file reached"
End If
End Sub
'Move Last
btn_previous.Enabled = True
btn_next.Enabled = False
Rs.MoveLast
If Rs.EOF <> True Then
txt_empno.Text = Rs("empno")
txt_ename.Text = Rs("Ename")
txt_job.Text = Rs("job")
txt_mgr.Text = Rs("mgr")
txt_hiredate.Text = Rs("hiredate")
txt_sal.Text = Rs("sal")
txt_deptno.Text = Rs("deptno")
Else
MsgBox "End of file reached"
End If
End Sub
show1
clear
search = "select * from emp11 where empno=" & txt_no.Text & ""
Set Rs = conn.OpenResultset(search, rdOpenDynamic, rdConcurRowVer)
If Rs.RowCount <> 0 Then
txt_empno.Text = Rs("Empno")
txt_ename.Text = Rs("Ename")
txt_job.Text = Rs("job")
txt_mgr.Text = Rs("mgr")
txt_hiredate.Text = Rs("hiredate")
txt_sal.Text = Rs("sal")
txt_deptno.Text = Rs("deptno")
Else
MsgBox "Record not available"
End If
81
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
End Sub
82
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
txt_sal.Visible = True
txt_deptno.Visible = True
lbl_empno.Visible = True
lbl_ename.Visible = True
lbl_job.Visible = True
lbl_mgr.Visible = True
lbl_hiredate.Visible = True
lbl_sal.Visible = True
lbl_deptno.Visible = True
End Function
Design
Title: Application to make the following operations on employees
control
83
Visual Programming Lab Manual (MCA 407)
BAPATLA ENGINEERING COLLEGE: BAPATLA
Department of MCA
84
Visual Programming Lab Manual (MCA 407)