LABfile-Jhanvi Pathak
LABfile-Jhanvi Pathak
Greater Noida
1|Page
INDEX
S.No Lab Assignment Page No Date of Teacher’s
Execution Signature
1 Write a program to construct 4-6 23-Aug-21
a calculator
2 Write a program to show the 7 06-Sep-21
concept of Keyword
Constant
3 Write a program to show the 8 06-Sep-21
concept of Keyword Enum
4 Write a program to check if 9 13-Sep-21
else condition
5 Write a program to check 10-11 13-Sep-21
else if condition
6 Write a program to show the 12 20-Sep-21
execution of for loop
7 Write a program to show the 13 20-Sep-21
execution of do while loop
8 Write a program to find out 12 05-Oct-21
the area of circle from given
radius with const keyword
9 Write a program to show the 15-17 11-Oct-21
use of Timer and create
Timer Watch
10 Write a program to show the 18 18-Oct-21
use of tree view control and
add nodes in it.
11 Write a program to show the 19-21 25-Oct-21
use of ComboBox and
ListBox controls
12 Write a program to add the 22 08-Nov-21
two given numbers
13 Write a program to subtract 23 08-Nov-21
the two given numbers
14 Write a program to multiply 24 08-Nov-21
the two given numbers
15 Write a program to divide 25 08-Nov-21
the two given numbers
16 Write a program to show the 26 22-Nov-21
use of open file dialog box
17 Write a program to show the 27 22-Nov-21
use of colour dialog box
18 Write a program to show the 28 22-Nov-21
use of font dialog box
19 Write a program to show the 29-30 22-Nov-21
use of save file dialog box
20 Write a program to show the 31 29-Nov-21
2|Page
concept of function
overloading
21 Write a program to show the 32 29-Nov-21
concept of inheritance
3|Page
PROGRAM-1
Write a program to construct a calculator
SOURCE CODE:
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If RadioButton1.Checked = True Then
TextBox3.Text = Val(TextBox1.Text) + Val(TextBox2.Text)
ElseIf RadioButton2.Checked = True Then
TextBox3.Text = Val(TextBox1.Text) - Val(TextBox2.Text)
ElseIf RadioButton3.Checked = True Then
TextBox3.Text = Val(TextBox1.Text) * Val(TextBox2.Text)
ElseIf RadioButton4.Checked = True Then
TextBox3.Text = Val(TextBox1.Text) / Val(TextBox2.Text)
ElseIf RadioButton5.Checked = True Then
TextBox3.Text = Val(TextBox1.Text) ^ Val(TextBox2.Text)
ElseIf RadioButton6.Checked = True Then
TextBox3.Text = Val(Math.Sqrt(TextBox1.Text))
Else
MsgBox("No operation selected!", MsgBoxStyle.Exclamation)
End If
End Sub
End Class
OUTPUT
4|Page
5|Page
6|Page
PROGRAM-2
Write a program to show the concept of Keyword Constant
Code
Class areaofsquare
Public Shared Sub Main()
Const a = 20
Dim area = a * a
Console.WriteLine($"area of square is {area} ")
Console.ReadKey()
End Sub
End Class
Output
7|Page
PROGRAM-3
Write a program to show the concept of Keyword Enum
Code
Module Enum_Data
Enum Fruits
' List of enumerated data
Banana
Mango
Orange = 6
Pineapple
Apple
End Enum
Sub Main()
Console.WriteLine(" Fruit code of Banana " & Fruits.Banana) 'call with enumeration and items name
Console.WriteLine(" Fruit code of orange " & Fruits.Mango)
Console.WriteLine(" Fruit code of oranges " & Fruits.Orange)
Console.WriteLine(" Fruit code of pineapple " & Fruits.Pineapple)
Console.WriteLine(" Fruit code of apple " & Fruits.Apple)
Output
8|Page
PROGRAM-4
Write a program to check if else condition
CODE
Module decisions
Sub Main()
'local variable definition '
Dim a As Integer
Console.Write("ENTER THE NUMBER : ")
a = Integer.Parse(Console.ReadLine())
OUTPUT
9|Page
PROGRAM-5
Write a program to check else if condition
Code
Module decisions
Sub Main()
'local variable definition '
Dim A As Integer
Console.Write("ENTER THE NUMBER :10 or 20 ")
A = Integer.Parse(Console.ReadLine())
' check the boolean condition '
If (A = 10) Then
' if condition is true then print the following '
Console.WriteLine("Value of is 10") '
ElseIf (A = 20) Then
'if else if condition is true '
Console.WriteLine("Value of a is 20") '
Else
'if none of the conditions is true
Console.WriteLine("None of the values is matching")
End If
End Sub
End Module
OUTPUT
10 | P a g e
11 | P a g e
PROGRAM-6
Write a program to show the execution of for loop
Code
Module loops
Sub Main()
Dim a, b, t As Byte
Console.Write("ENTER THE NUMBER TO GET ITS TABLE : ")
b = Integer.Parse(Console.ReadLine())
Console.Write(Environment.NewLine)
Console.WriteLine("Table is : ")
Console.Write(Environment.NewLine)
For a = 1 To 10
t=b*a
Console.WriteLine(t)
Next
Console.WriteLine("that is the table")
End Sub
End Module
Output
12 | P a g e
PROGRAM-7
Write a program to show the execution of do while loop
CODE:
Module loops
Sub Main()
Dim a = 1, b, t As Integer
Console.Write("ENTER THE NUMBER TO GET ITS TABLE : ")
b = Integer.Parse(Console.ReadLine())
Console.Write(Environment.NewLine)
Console.WriteLine("Table OF {0} IS : ", b)
Console.Write(Environment.NewLine)
Do
t=b*a
Console.WriteLine(t)
a=a+1
13 | P a g e
PROGRAM-8
Write a program to find out the area of circle from given radius with const
keyword
CODE:
Module Module1
Sub Main()
End Sub
End Module
OUTPUT:
14 | P a g e
PROGRAM-9
Q1. Write a program to show the use of Timer and create Timer Watch.
CODE:
START BUTTON
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Timer1.Enabled = True
Timer1.Start() 'Start the timer
End Sub
STOP BUTTON
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Timer1.Stop() ' Stop the timer
End Sub
ON FORM 1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.Text = "time form"
Label1.Text = "Timer Control"
TextBox1.Text = 1
Timer1.Enabled = True
Button1.Text = "Start"
Button1.BackColor = Color.Blue
Button1.ForeColor = Color.AliceBlue
Button2.Text = "Stop"
Button2.BackColor = Color.Green
Button2.ForeColor = Color.AliceBlue
15 | P a g e
Timer1.Start()
Timer1.Interval = 600
End Sub
ON TIMER 1
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
If Label1.ForeColor = Color.Green Then
Label1.ForeColor = Color.BlueViolet
End Sub
OUTPUT:
START
16 | P a g e
STOP
17 | P a g e
PROGRAM-10
Write a program to show the use of tree view control and add nodes in it.
CODE:
Public Class Form1
TreeView1.Nodes.Add(A, A, 0, 1)
Else
TreeView1.SelectedNode.Nodes.Add(A, A, 0, 1)
End If
End Sub
End Sub
End Class
CODE:
18 | P a g e
PROGRAM-11
Write a program to show the use of ComboBox and ListBox controls.
CODE:
Public Class Form1
Label1.Text = ListBox1.SelectedItem
End Sub
End Sub
End Sub
End Sub
End Sub
19 | P a g e
OUTPUT:
ADD
COUNT
20 | P a g e
ADD ITEMS(LABEL)
CLEAR
REMOVE
PROGRAM-12
Write a program to add the two given numbers
21 | P a g e
CODE
Module Module1
Sub Main()
Dim num1, num2, sum As Integer
End Module
CODE:
22 | P a g e
PROGRAM-13
Write a program to subtract the two given numbers
CODE:
Module Module1
Sub Main()
Dim num1, num2, Subtraction As Integer
End Module
OUTPUT:
23 | P a g e
PROGRAM-14
Write a program to multiply the two given numbers
CODE:
Module Module1
Sub Main()
Dim num1, num2, multiply As Integer
End Module
OUTPUT:
24 | P a g e
PROGRAM-15
Write a program to divide the two given numbers
CODE:
Module Module1
Sub Main()
Dim num1, num2, divide As Integer
End Module
OUTPUT:
25 | P a g e
PROGRAM-16
Write a program to show the use of open file dialog box
CODE :
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If OpenFileDialog1.ShowDialog <> Windows.Forms.DialogResult.Cancel Then
PictureBox1.Image = Image.FromFile(OpenFileDialog1.FileName)
End If
End Sub
End Class
OUTPUT
26 | P a g e
PROGRAM-17
Write a program to show the use of colour dialog box
CODE;:
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If ColorDialog1.ShowDialog <> Windows.Forms.DialogResult.Cancel Then
Label1.ForeColor = ColorDialog1.Color
End If
End Sub
End Class
OUTPUT :
27 | P a g e
PROGRAM-18
Write a program to show the use of font dialog box
Code;
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If FontDialog1.ShowDialog <> Windows.Forms.DialogResult.Cancel Then
RichTextBox1.ForeColor = FontDialog1.Color
RichTextBox1.Font = FontDialog1.Font
End If
End Sub
End Class
OUTPUT:
28 | P a g e
PROGRAM-19
Write a program to show the use of save file dialog box
CODE :
End Sub
OUTPUT:
29 | P a g e
30 | P a g e
PROGRAM-20
Write a program to show the concept of function overloading
CODE:
Imports System
Class adder
Public Overloads Sub Add(A As String, B As String)
Console.WriteLine("Adding Strings: " + A + B)
End Sub
OUTPUT:
31 | P a g e
PROGRAM-21
Write a program to show the concept of inheritance
CODE:
Imports System
Class Human
Public Sub Talk()
Console.WriteLine("Talking")
End Sub
End Class
Class Programmer
Inherits Human
Rohan.Talk()
Rohan.StealCode()
End Sub
End Class
OUTPUT:
32 | P a g e
PROGRAM-22
Write a program to show the concept of overriding
CODE:
Imports System
Class Human
Public Overridable Sub Speak()
Console.WriteLine("Speaking")
End Sub
Class Indian
Inherits Human
End Sub
End Class
Class MainClass
Johan.Speak()
Tony.Speak()
End Sub
End Class
End Class
OUTPUT:
33 | P a g e
PROGRAM-23
Show all the steps of connection with database
OUTPUT:
34 | P a g e
35 | P a g e
36 | P a g e