Professional Documents
Culture Documents
1. To implement a Visual Basic Form with load event with design a Digital clock with a date. (L1-
Recognizing) [CO1]
Ans:-
A new standard EXE project is opened by selecting New command from the file menu.
Two textbox controls are placed in the Form.
The timer control is chosen from the textbox and placed in the form.
The Properties window of the timer control is viewed by clicking it and pressing F4.
The interval property of the timer control is set to 1000 which implies that the timer is activated
every single second.
The following code is entered in the form_load() procedure.
1
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
OUTPUT
2
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
4. Write a Visual Basic script to display the name of the students given by users (use input box and
message box). (L1-RECOGNIZING)[CO3]
Ans.
A new Standard EXE project is opened by selecting New command from the File menu.
A InputBox is placed to enter a name.
A CommandButton is placed to perform the required task.
The following code is entered in the Command1_Click() procedure.
OUTPUT
3
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
4
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
End Sub
OUTPUT
5
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
7. Southern railways need to validate the date of travel for the reservation facility. The booking
should be either on that current day or for the next 15 days. How could we implement this in visual
basic? (L2) [CO3]
Ans.
A new Standard EXE project is opened by selecting New command from the File menu.
A CommandButton is placed to display the entered date.
A TextBox is created to enter the date of travel.
After clicking OK the validity of entered date is checked.
The following code is entered in the Command1_Click() procedure.
6
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
OUTPUT
7
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
8. Write an event procedure in VB to calculate the future value of a given present amount (interest
rate per annum and year are given) (L1-remebering) [CO2]
Ans:-
A new standard EXE project is opened by selecting New command from the file menu.
A textbox control and a lebel is placed in the Form.
In the TextBox the amount is given for the required calculation.
The following code is entered in the Command1_Click() procedure.
OUTPUT
8
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
9. Write an event procedure to convert the number from Fahrenheit to Centigrade using simple
Textbox and Button. (L1) [CO3]
Ans:-
A new standard EXE project is opened by selecting New command from the file menu.
A textbox controls is placed in the Form.
In the TextBox the temperature in Fahrenheit is given for the required calculation.
The following code is entered in the Command1_Click() procedure.
OUTPUT
9
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
10. Write a Visual Basic script to create a Temperature Conversion Application. The form should
look like this. (L2) [CO3]
Ans:-
A new standard EXE project is opened by selecting New command from the file menu.
Two textbox controls are placed in the Form for the required fields as shown.
A vertical scroll bar is placed as shown above.
TextBox 1 is for temperature in Fahrenheit.
10
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
Text1.Text = cen
far = (9 * cen) / 5 + 32
Text2.Text = Str(far)
cen = cen + 1
Wend
End Sub
OUTPUT
11
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
14. Write a Visual Basic program to check the number is odd or not. (L2) [CO3]
Ans.
A new Standard EXE project is opened and saved.
A CommandButton is placed to check whether the entered number is even or odd.
A TextBox is created to enter the number.
After clicking CHECK EVEN OR ODD the required program is executed.
The following code is entered in the Command1_Click() procedure.
12
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
OUTPUT
15. Write a Visual Basic script to find out the factorial of a number. (L2) [CO3]
.Ans.
A new Standard EXE project is opened and saved.
A CommandButton is placed to calculate the factorial of a number.
A TextBox is created to enter the number.
After clicking FACTORIAL the required program is executed.
The following code is entered in the Command1_Click() procedure.
13
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
16. Write a program in Visual basic to check the number is Armstrong number or not using Input
Box() and Message Box() (L2) [CO3]
Ans:-
14
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
r = x Mod 10
i=i+r*r*r
x = x / 10
Wend
If n = i Then
Print "the number is armstrong"
Else
Print "the number is not armstrong"
End If
End Sub
OUTPUT
19. Write a function procedure using call by value and also call by references. (L2) [CO2]
Ans:-
A new Standard EXE project is opened and saved.
A CommandButton is placed to calculate power of a number.
15
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
After clicking on command button the required program is executed.
The following code is entered in the Command1_Click() procedure.
power = pow
End Function
OUTPUT
16
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
OUTPUT
17
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
A new standard EXE project is opened by selecting New command from the file menu.
A textbox control is placed in the Form.
A CommandButton conversion is placed for calculating temperature in Celsius.
The code is entered in Command1_click()
OUTPUT
18
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
A new standard EXE project is opened by selecting New command from the file menu.
A textbox control is placed in the Form for input.
A CommandButton is placed for checking whether its a prime number or not.
The code is entered in Command1_click()
19
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
If r = 0 Then
flag = 1
Exit Do
End If
i=i+1
Loop
prime = flag
End Function
OUTPUT
20
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
Dim i, flag, r As Integer
flag = 0
i=2
Do While i < n / 2
r = n Mod i
If r = 0 Then
flag = 1
Exit Do
End If
i=i+1
Loop
prime = flag
End Function
OUTPUT
21
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
20. Design a Form that has two combo boxes that displays the names of trains and the days of the
week. (L2) [CO3]
There are certain trains which will not operate on a particular day of the week and the details are
enlisted below; (use message box)
.Ans.
A new Standard EXE project is opened and saved. The caption property of the form is set as
Train Schedules
The form is designed as per the specifications given in the following table.
Object Property Value
Label Caption Enter the Day of Journey
Combo box Name List CboTrName
Nellaui Express
Vaigai Express
Brindavan Express
Lalbagh Express
Shatabdi Express
Mysore-Chennai Express
Blue mountain Express
RockFort Express
Text
Train Names
Combo box Name CboDay
List Sunday
Monday, etc
Text Days
The following code is entered in the Click() event of the cboDay combo box control.
22
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
Else
MsgBox "The Train will be plying"
End If
End Sub
OUTPUT
23
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
Q21. Write a Visual Basic programe to implement a circle (with graphics programming). (L3)
[CO3]
Ans.
OUTPUT
23. Write a Visual Basic Program to addition of number using 1-D array. (L2) [CO3]
Ans:-
24
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
A new standard EXE project is opened by selecting New command from the file menu.
A commandButton is placed in the form to calculate the sum.
The following code is entered under Command_Click() procedure.
OUTPUT
25
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
24. Write a Visual Basic program to find the maximum, minimum number from a 1-D array. (L2) [CO3]
Ans:-
A new standard EXE project is opened by selecting New command from the file menu.
A CommandButton is placed in the form to check.
The following code is entered under Command1_Click() procedure.
26
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
OUTPUT
27
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
26. Develop an application to implement menu control arrays at run time where the new trains can
be added and non-existent ones can be deleted (The last menu item mnSep is selected to add new
train no.).(L3) [CO4]
Caption Name
&File mnufile
&Add mnadd
&Delete mndelete
E&xit mnexit
- mnsep
Ans.
A new Standard EXE project is opened and saved. The caption property of the form is changed to
menu Control Arrays. Menu items are added to the Form as given below:
Caption Name
File mnuFile
&Add mnAdd
&Delete mnDelete
E&xit mnExit
- mnSep
The last menu item mnSep is selected and the Index is set tob 0.
The following code is entered in the declaration section of the Form.
Option Explicit
Dim LastItem As Integer
28
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
LastItem = LastItem + 1
Load mnsep(LastItem)
mnsep(LastItem).Caption = "TRAIN NO." + Str(LastItem)
mndelete = True
End Sub
OUTPUT
29
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
28. Write a Visual Basic script where a pizza order can be entered by simply clicking on option
buttons and check boxes. (L2) [CO3]
Ans.
A new Standard EXE project is opened by selecting New command from the File menu.
Radio buttons and check boxes are according to the layout given.
Two CommandButton are placed to display the entered name.
The following code is entered in the Command1_Click() procedure.
30
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
op2 = Option2.Caption
op3 = Option3.Caption
op4 = Option4.Caption
op5 = Option5.Caption
op6 = Option6.Caption
op7 = Option7.Caption
If Option1.Value = True Then
size = op1
ElseIf Option2.Value = True Then
size = op2
Else
size = op3
End If
If Option4.Value = True Then
ctype = Option4.Caption
Else
ctype = Option5.Caption
End If
If Option6.Value = True Then
need = Option6.Caption
Else
need = Option7.Caption
End If
If Check1.Value = 1 Then
chk1 = Check1.Caption
MsgBox "You have selected one " + size + " pizza with " + ctype + " having " + chk1
If Check1.Value = 1 Then
chk2 = Check2.Caption
MsgBox "You have selected one " + size + " pizza with " + ctype + " having " + chk2
ElseIf Check3.Value = 1 Then
chk3 = Check3.Caption
MsgBox "You have selected one " + size + " pizza with " + ctype + " having " + chk3
ElseIf Check4.Value = 1 Then
chk4 = Check4.Caption
MsgBox "You have selected one " + size + " pizza with " + ctype + " having " + chk4
ElseIf Check5.Value = 1 Then
chk5 = Check5.Caption
MsgBox "You have selected one " + size + " pizza with " + ctype + " having " + chk5
ElseIf Check6.Value = 1 Then
chk6 = Check6.Caption
MsgBox "You have selected one " + size + " pizza with " + ctype + " having " + chk6
Else
all = chk1 + chk2 + chk3 + chk4 + chk5 + chk6
MsgBox "You have selected one " + size + " pizza with " + ctype + " having " + chk6
End If
End If
End Sub
31
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
End Sub
OUTPUT
32
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
30. Create a student database and develop a VB application using ODBC database connectivity
where the value from the database will display in the form with suitable design (L2) [CO4]
(Assume student table contains fields roll, name, address, course, marks)
Ans:-
33
Techno India College of Technology
2nd Year 4Th Sem CSE (2014-18)
Software Tools (CS 492) Assignment
OUTPUT
34