Professional Documents
Culture Documents
Done Lab Manual 1
Done Lab Manual 1
net
LAB MANUAL
WINDOWS PRACTICALS
1) Write a program in VB.NET which will display the functionality of Button click
event using the MsgBox.
OUTPUT:-
1
2) Write a program in VB.NET which will change double to integer data type and
showing the result on lable on the command button click event.
2
Private Sub Frmprog2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.WindowState = FormWindowState.Maximized
End Sub
Dim a As Double
a = TextBox1.Text
Label3.Text = CInt(TextBox1.Text)
End Sub
End Class
OUTPUT:-
3) Write a program in VB.NET which will display the functionality of isDate() function.
3
Public Class Frmprog3
4) Write a program in VB.NET which will check if a assignment is numeric or not using
isNumeric() function.
4
Public Class Frmprog4
5
5) Write a program in VB.NET showing the functionality to enter any two numbers in
two different textboxes and create buttons of +,-,X,\,^,/ and MOD. Display the
answer on label
c=a+b
Label4.Text = c
End Sub
6
End Sub
End Class
OUTPUT:-
7
6) Enter any number in inputbox and check it is zero , positive or negative using if.. end
if
OUTPUT:-
8
7) Write an application in vb.net in which enter one number in textbox and find out is it 1.
Even/odd 2. Prime/not 3. Magic/not 4. Factorial 5. Square root of it when we put mouse
on respective labels
9
Imports System.Math
Public Class Frmprog7
End If
End Sub
10
End If
Next
If (prime = 0) Then
lbprime.Text = "Prime"
Else
lbprime.Text = "Not Prime"
End If
End Sub
End Sub
End Class
OUTPUT:-
11
8) Enter year in a textbox and check year is leap / not on label control
12
End Sub
End Class
OUTPUT:-
9) Write a program in VB.NET which will ask the values from users and will display the
result by using the functionality of Select-Case
13
Public Class Frmprog9
End Select
End Sub
End Class
OUTPUT:-
14
10) Write a program in VB.NET which will display the functionality of trim function
which will remove the charatcters as per requirement
End Sub
15
S
11)Write a program in VB.NET which will display the functionality of UCase, LCase,
ToUpper, ToLower
16
Me.WindowState = FormWindowState.Maximized
End Sub
End Sub
17
12) Write a program in VB.NET which will display the functionality of listbox
18
MsgBox(ListBox1.SelectedItems.Item(i))
Next
End Sub
19
Private Sub BTNINSERT_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles BTNINSERT.Click
Dim s As String
Dim i As Integer
i -= 1
i = InputBox("Enter Location Where u want to Insert")
s = InputBox("Enter FoodName:")
ListBox1.Items.Insert(i, s)
End Sub
End Sub
20
13)Write a program in VB.NET which will display the functionality of Combobox
21
MsgBox(ComboBox1.SelectedItem)
End Sub
a -= 1
If ComboBox1.Items.Contains(b) = False Then
ComboBox1.Items.Insert(a, b)
Else
MsgBox("Alredy In list")
End If
End Sub
End Class
OUTPUT:-
22
23
14)Enter student’s name, pick up degree and year from combo box and then enter 7
subject marks in textboxes, then calculate total, per and print grade on various label
using lost focus event of textbox
24
Public Class Frmprog14
Frmprog14_1.LABNAME.Text = TXTNAME.Text
Frmprog14_1.LABDEGREE.Text = COMBOCOURCE.SelectedItem
Frmprog14_1.LABYEAR.Text = COMBOYEAR.SelectedItem
Frmprog14_1.LABS1.Text = TXTS1.Text
Frmprog14_1.LABS2.Text = TXTS2.Text
Frmprog14_1.LABS3.Text = TXTS3.Text
Frmprog14_1.LABS4.Text = TXTS4.Text
Frmprog14_1.LABS5.Text = TXTS5.Text
Frmprog14_1.LABS6.Text = TXTS6.Text
Frmprog14_1.LABS7.Text = TXTS7.Text
25
Frmprog14_1.LABTOT.Text = CInt(TXTS1.Text) + CInt(TXTS2.Text) +
CInt(TXTS3.Text) + CInt(TXTS4.Text) + CInt(TXTS5.Text) + CInt(TXTS6.Text) +
CInt(TXTS7.Text)
Frmprog14_1.LABPR.Text = (Frmprog14_1.LABTOT.Text / 7)
26
15)Enter employee name , pick up dept name from combo box , and then enter basic
salary into textbox and using keypress event calculate total salary using [ HRA (35%) , DA
(85%) , MA ( 10%) , TA (15%).. ,-> Total Salary , Deduction : PF (8.5%) , IT (15%), Loan-fund
(10%)-> deduction , finally find out Net salary using key press event)
27
Public Class Frmprog15
LBDA.Text = (A * 85 / 100)
LBMA.Text = (A * 10 / 100)
LBTA.Text = (A * 15 / 100)
LBIT.Text = (A * 15 / 100)
28
LBLF.Text = (A * 10 / 100)
16)Write an application in vb.net which put one button named ‘Input Data’ When we click
on it, it ask as minimum and maximum value. Then one combobox should display even ,
odd , prime are the list item when we click on any of them, between min to max that list
item’s numbers should be display at label
29
Public Class Frmprog17
Dim s As String
Dim p As String
'Frmprog2.Label1.Text = "your Name is:- " & txtname.Text
'Frmprog2.Label2.Text = "your address is:- " & txtadd.Text
'Frmprog2.Label3.Text = "your phone number is:- " & txtph.Text
s = "Male"
30
s = "Female"
End If
If radcash.Checked = True Then
p = " Cash"
ElseIf radcr.Checked = True Then
p = "Credit"
End If
'If radcash.Checked = True Then
'Frmprog2.Label5.Text = "Your Payment Mode Is Cash"
'ElseIf radcr.Checked = True Then
'Frmprog2.Label5.Text = "Your Payment Mode is credit"
'End If
Dim c As String
If CHKS.Checked = True And CHKT.Checked = True And CHKR.Checked = True
Then
c = "Singing, Travelling And Reading"
ElseIf CHKS.Checked = True And CHKT.Checked = True Then
c = "Singing And Travelling "
ElseIf CHKS.Checked = True And CHKR.Checked = True Then
c = "Singing And Reading"
ElseIf CHKT.Checked = True And CHKR.Checked = True Then
c = "Travelling And Reading"
ElseIf CHKS.Checked = True Then
c = "Singing"
ElseIf CHKT.Checked = True Then
c = "Travelling"
ElseIf CHKR.Checked = True Then
c = "Reading"
End If
MsgBox("Your Name is : " & txtname.Text & vbNewLine & "Your Address is : " &
txtadd.Text & vbNewLine & "Your phone number is: " & txtph.Text & vbNewLine &
"Your Gender is: " & s & vbNewLine & "Your Payment Mode is :" & p & vbNewLine &
"Your Hobbies Is : " & c)
End Sub
31
18)Write an application in vb.net which has check boxes and parallel textboxes are there
on selection of checkbox - Item name , price and quantity textbox display ( visible ) . enter
qty and for multiple item generate the total bill and get net bill at label using following
discount scheme
Total bill Discount
1000 – 2000 Rs. 10%
2000 – 5000 Rs. 20%
>=5000 Rs. 25%
32
Public Class Frmprog18
33
TextBox4.Text = "195"
End If
End Sub
End Class
OUTPUT:-
19)Write an application in vb.net which display one textbox and having three radio
buttons named ‘left justify’ , ‘ right justify ‘ and ‘center ‘ when we click on it,it should
works
34
Public Class Frmprog19
35
20)Write an application in vb.net which has 1 combo box for menu type ( Guj. Punjabi ,
Chinese) then after at the selection of menu type, menu items are added to the listbox at
dynamic level. Finally selection of menu item, price should be display at label and quantity
textbox appear, at key press event of textbox get the bill of order.
36
Private Sub Frmprog20_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.WindowState = FormWindowState.Maximized
End Sub
37
lbprice.Text = " 80"
ElseIf ListBox1.SelectedItem = "Kaju Masala" Then
lbprice.Text = " 60"
ElseIf ListBox1.SelectedItem = "Dry Manchurian" Then
lbprice.Text = " 45"
ElseIf ListBox1.SelectedItem = "Grevy Manchurian" Then
lbprice.Text = " 50"
ElseIf ListBox1.SelectedItem = "Chinese Bhel" Then
lbprice.Text = " 50"
ElseIf ListBox1.SelectedItem = "Shoup" Then
lbprice.Text = " 30"
ElseIf ListBox1.SelectedItem = "Salad" Then
lbprice.Text = " 20"
End If
End Sub
38
21)Write an application in vb.net which display 1 textbox , 2 check box named ‘red’ . ‘blue’
for background color and 2 check box named ‘yellow’ and ‘green’ for foreground color
when we click it , it should works
End Sub
End Sub
39
End If
End Sub
OUTPUT:-
22)Write a program in VB.NET which will implement the mouse entered event and will
give the message when mouse is entered onto the form
40
Public Class Frmprog22
41
23)Write a program in VB.NET which will display the functionality of minimum 3 events of
Button and textbox control.
42
MsgBox("THIS IS BUTTON KEYDOWN EVENT")
End Sub
43
Me.WindowState = FormWindowState.Maximized
End Sub
24)Write a program in VB.NET which will show the functionality of FOR-NEXT WHILE loop
with the STEP in MINUS
For i = 10 To 1 Step -1
Label1.Text &= i
Next
End Sub
End Class
OUTPUT:-
25)Write a program in VB.NET which will show the functionality of DO - LOOP WHILE
44
Public Class Frmprog25
Dim i As Integer = 1
While i <= 10
45
label1.text &= i
i=i+1
End While
End Sub
End Class
OUTPUT:-
Dim a As String
Dim b As Char
a = "ARPAN"
For Each b In a
MsgBox(b)
Label1.Text = b
Next
End Sub
End Class
OUTPUT:-
46
28)Write a program in VB.NET to validate a text box to allow only enter numeric data in it
else give msgbox
47
If Asc(e.KeyChar) > 47 And Asc(e.KeyChar) < 58 Then
MsgBox("correct")
Else
MsgBox("enter no. only")
e.KeyChar = ""
End If
'If TextBox1.Text >= 0 And TextBox1.Text <= 9 Then
' MsgBox("correct")
'Else
' MsgBox("wrong")
'End If
End Sub
End Class
OUTPUT:-
29)Write an Application in Vb.net which transfer each data value from listbox1 to listbox2
by cliking of ‘>’ , ‘>>’ , ‘<’ , ‘<<’ same with listbox2 to listbox1.
48
Public Class Frmprog29
Private Sub frmpro29_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.WindowState = FormWindowState.Maximized
End Sub
49
Next
End Sub
Next
End Sub
50
Imports System.Drawing
'Imports System.Windows.Forms.PictureBox
Imports System.Math
demoimage(0) = "D:\college
Files\vb.Net\Task\WinPracticallist\WinPracticallist\DEMOIMAGE\Pallavi
Pandya 014.png"
demoimage(1) = "D:\college
Files\vb.Net\Task\WinPracticallist\WinPracticallist\DEMOIMAGE\Pallavi
Pandya 018.png"
51
demoimage(2) = "D:\college
Files\vb.Net\Task\WinPracticallist\WinPracticallist\DEMOIMAGE\Pallavi
Pandya 019.png"
demoimage(3) = "D:\college
Files\vb.Net\Task\WinPracticallist\WinPracticallist\DEMOIMAGE\Pallavi
Pandya 027.png"
PictureBox1.Image = Image.FromFile(demoimage(0))
End Sub
Dim i, j As Double
j=1
For i = 1 To HScrollBar1.Value
j=j*i
Next
Label4.Text = j
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
HScrollBar1.Maximum = ComboBox1.SelectedItem
End Sub
End Class
OUTPUT:-
52
31)Write an application in vb.net which has three scroll bar named ‘red’ , ‘blue’ and
‘green’ having maximum value of 255 on scrolling of each 1 label color must be changed as
per their value
32)Write a program in VB.NET to create an application having functionality like cut, copy,
paste, clear etc in textbox using button.
53
Public Class frmprog32
54
TextBox1.Undo()
End Sub
End Sub
33)Write an application in vb.net which that display your five friends name with different
images using auto execution of timer having 1 seconds [ use timer , interval – property ,
_tick event]
55
Public Class Frmprog33
Public I As Integer = 1
Private Sub Frmprog33_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.WindowState = FormWindowState.Maximized
End Sub
End Sub
56
Timer1.Stop()
End Sub
End Sub
End Class
57
Public Class Frmprog34
Public I As Integer = 1
Private Sub Frmprog34_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.WindowState = FormWindowState.Maximized
End Sub
End Sub
58
End Sub
ElseIf I = 2 Then
PictureBox1.Image = Image.FromFile("D:\college
files\vb.net\Prac_assignment\Prac_assignment\Bang.jpg")
I += 1
ElseIf I = 3 Then
PictureBox1.Image = Image.FromFile("D:\college
files\vb.net\Prac_assignment\Prac_assignment\Be Happy.jpg")
I += 1
ElseIf I = 4 Then
PictureBox1.Image = Image.FromFile("D:\college
Files\vb.Net\Task\WinPracticallist\WinPracticallist\DEMOIMAGE\Cool
_Clock.jpg")
I += 1
ElseIf I = 5 Then
PictureBox1.Image = Image.FromFile("D:\college
Files\vb.Net\Task\WinPracticallist\WinPracticallist\DEMOIMAGE\Do
or Die.jpg")
I += 1
ElseIf I = 6 Then
PictureBox1.Image = Image.FromFile("D:\college
Files\vb.Net\Task\WinPracticallist\WinPracticallist\DEMOIMAGE\Don
t Scare Me.jpg")
I += 1
ElseIf I = 7 Then
PictureBox1.Image = Image.FromFile("D:\college
Files\vb.Net\Task\WinPracticallist\WinPracticallist\DEMOIMAGE\Abst
ract Tiger.jpg")
I=1
End If
End Sub
End Class
35)Write an application in vb.net which display real calculator having 0-9 , . , clear , +,-,*,/,
and = button
59
I
36)Write a program in VB.NET which will display the functionality of RichTextBox which
will change the background color and foreground color (font color)
60
If ColorDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
RichTextBox1.ForeColor = ColorDialog1.Color
End If
End Sub
37)Write a program in VB.NET which will on click of button open OpenFileDialog and
display file name.
61
Public Class Frmprog37
End If
End Sub
62
End Class
38)Write a program in VB.NET which will on click of buttton open the FontDialog and
apply effect on RichTextBox
63
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
If FontDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
RichTextBox1.SelectionFont = FontDialog1.Font
RichTextBox1.SelectionColor = FontDialog1.Color
End If
End Sub
End Class
39)Write a program in VB.NET which will display images and display selected images in
picturebox using OpenFileDialog
64
If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
PictureBox1.Image = Image.FromFile(OpenFileDialog1.FileName)
End If
End Sub
40)Write a program in VB.NET which will display the functionality of colordialogbox which
will change the background color of the form runtime.
65
End Sub
End Class
41)Write a program in VB.NET which will display the functionality of TreeView control
End Sub
66
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
TreeView1.CollapseAll()
End Sub
End Sub
End Class
OUTPUT:-
67
42)Write a program in VB.NET which will display the functionality of ListView control
68
Public Class frmprog42
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
If ComboBox1.SelectedItem = "Tile" Then
ListView1.View = View.Tile
ElseIf ComboBox1.SelectedItem = "Details" Then
ListView1.View = View.Details
ElseIf ComboBox1.SelectedItem = "Large Icon" Then
ListView1.View = View.LargeIcon
ElseIf ComboBox1.SelectedItem = "List" Then
ListView1.View = View.List
ElseIf ComboBox1.SelectedItem = "Small Icon" Then
ListView1.View = View.SmallIcon
End If
End Sub
69
Private Sub frmprog42_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.WindowState = FormWindowState.Maximized
ListView1.View = View.Details
ListView1.Columns.Add("RESTURANT", 190, HorizontalAlignment.Left)
ListView1.Columns.Add("AREA", 90, HorizontalAlignment.Left)
ListView1.Columns.Add("RATING", 90, HorizontalAlignment.Left)
ListView1.Items.Add("GORDHN THAL")
ListView1.Items(0).SubItems.Add("SG RD")
ListView1.Items(0).SubItems.Add("5")
ListView1.Items.Add("TOMATOES")
ListView1.Items(1).SubItems.Add("CG RD")
ListView1.Items(1).SubItems.Add("5")
ListView1.Items.Add("DESI TADKA")
ListView1.Items(2).SubItems.Add("SG RD")
ListView1.Items(2).SubItems.Add("5")
ListView1.Items.Add("PATANG")
ListView1.Items(3).SubItems.Add("nEHRU")
ListView1.Items(3).SubItems.Add("3")
ListView1.Columns.Add("AMBIENCE", 190, HorizontalAlignment.Left)
ListView1.Items(0).SubItems.Add("EXELENT")
ListView1.Items.Add("FREEZLAND")
ListView1.Items(4).SubItems.Add("LAW GARDEN")
End Sub
70
43)Write a program in VB.NET which will implement the mouse down event and show to
user the location of the mouse in a text box
Imports System.Drawing
Public Class frmprog43
71
Private Sub frmprog43_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.WindowState = FormWindowState.Maximized
End Sub
End Class
OUTPUT:-
72
Private Sub frmprog44_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.WindowState = FormWindowState.Maximized
End Sub
End If
Next
End Sub
End Class
OUTPUT:-
73
Public Class FRMMAINMENU
End Sub
74
46)Make application of login form with progess bar.
End Sub
ProgressBar1.Increment(10)
If ProgressBar1.Value = 100 Then
75
Timer1.Stop()
MsgBox("COMPLETE")
FRMMAINMENU.Show()
End If
Label1.Text = ProgressBar1.Value
End Sub
End Class
47)Check some mathematical function, String function , date time function using tab order
where you can use 3 tab and apply any min 5 function of each class as separately
48)Write an application in vb.net which has one date time picker as per select index
changed process apply some methods of date and time class like add days , today , now ,
addhours , addminute , isleapyer , daysofmonth. And check in form
49)write an application in vb.net which shows menues and contextmenu on MDI form.
50)Write an application in vb.net which looks like ‘Windows explorer’ having full facility of
drive,directory and file class methods and class utilization
76