GAD Full Manual

Download as pdf or txt
Download as pdf or txt
You are on page 1of 173

Sahil Rupesh Surve

102 20 21
Sahil Rupesh Surve
102
COMPUTER ENGINEERING (CO)
THAKUR POLYTECHNIC
0522

20 21

Mumbai 1905220527
22/06/2021 113000
CONTENT PAGE

List of Practicals and Progressive Assessment Sheet

Exp. Date of Date of


Name of Experiment Remark
No. Performance Submission
Install Set Up and Use VB.Net IDE
1 05/04/21 09/04/21
(Integrated Development Environment)
Design VB.NET application using Existing
2 09/04/21 12/04/21
Namespaces and User Defined Namespace.
Implement a Message Box program &
3 09/04/21 12/04/21
Arithmetic Expressions.
Implement a program for If-else control
4 12/04/21 16/04/21
structures in VB.NET.
Implement a program for Select case control
5 16/04/21 19/04/21
structures in VB.NET.
Implement a program for While, DO Loops in
6 16/04/21 19/04/21
VB.Net.
Implement a program to use of For, For-Each
7 19/04/21 23/04/21
Loops In VB.Net.
Design windows application using Text Box,
8 23/04/21 26/04/21
Label & Button
Design windows application using Radio
9 23/04/21 26/04/21
Button & Check Box.
Design windows application using List Box &
10 30/04/21 03/05/21
Combo Box.
Design windows application using Picture Box
11 30/04/21 03/05/21
& Panel
Design windows application using Tab Control
12 07/05/21 10/05/21
&Timer
Implement a Windows application to Perform 07/05/21 10/05/21
13 & 14
Validation. 10/05/21 14/05/21
Implement a windows application using Sub-
15 14/05/21 17/05/21
Procedures & Parameterized Sub-Procedures.
Implement a Program to Demonstrate Use of
16 14/05/21 17/05/21
Simple Function & Parameterized Functions
Understand the Concept of Class and Object of
17 21/05/21 24/05/21
Class
Implement a program for class constructor and
18 21/05/21 24/05/21
destructor to de- allocate memory.
19 Develop a Program for Inheritance 24/05/21 28/05/21
Implement a Program for Overloading & 24/05/21 28/05/21
20 & 21
Overriding 28/05/21 31/05/21
Exp. Date of Date of
Name of Experiment Remark
No. Performance Submission
Implement a Program to Demonstrate
22 28/05/21 31/05/21
Shadowing in Inheritance
Implement a Program to Handle Runtime
23 04/06/21 07/06/21
Errors Using Exception Handling
24 Understand the concept of ado.net. 04/06/21 07/06/21
25 & 26 Understand The Concept of Data Adapter 07/06/21 09/06/21
Understand The Concept of Select and Insert
27 09/06/21 11/06/21
Data In Database Table
28, 29
& 30 Understand the concept of data binding. 09/06/21 11/06/21

• To be transferred to Proforma of CIAAN-2017.


GUI APPLICATION DEVELOPMENT USING VB.NET
MANUAL
Name: Sahil Surve SYCO Roll No.:
102

EXPERIMENT NO. 1:
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102

EXPERIMENT NO. 2:
Design VB.NET application using Existing Namespaces and User Defined
Namespaces.

XI. Program Code:

• Write a program using User defined and Existing Namespaces in


VB.net

Imports System
Namespace Birds
Class Parrot
Public Shared Function fly()
Console.WriteLine("Parrot can fly")
End Function
Public Shared Function color()
Console.WriteLine("normally Parrots are green")
End Function
Public Shared Function type()
Console.WriteLine("Different type of parrot are found
around the world")
End Function
End Class
End Namespace
Module Module1
Public Function myfunction()
Dim P As Birds.Parrot
P = New Birds.Parrot()
Birds.Parrot.type()
End Function
Sub main()
Console.Clear()
Birds.Parrot.fly()
Birds.Parrot.color()

Page 1 of 6
myfunction()
Console.ReadLine()
End Sub
End Module

XII. Results (Output of the program):

Page 2 of 6
XIII. Practical Related Questions:

Page 3 of 6
XIV. Exercise

Page 4 of 6
2. Write a program to implement students namespace.
• Program Code:

Imports System
Namespace Student
Class Class1
Public Shared Function Name()
Console.WriteLine("Name of the student: SAHIL SURVE")
End Function
Public Shared Function YearAndBranch()
Console.WriteLine("Year: SY & Branch:CO")
End Function
Public Shared Function RollNo()
Console.WriteLine("Roll No.:
102")
End Function
End Class
End Namespace
Module Module1
Public Function myfunction()
Dim S As Student.Class1
S = New Student.Class1()
Student.Class1.RollNo()
End Function
Sub main()
Console.Clear()
Student.Class1.Name()
Student.Class1.YearAndBranch()
myfunction()
Console.ReadLine()
End Sub
End Module

Page 5 of 6
• Output:

Page 6 of 6
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102

EXPERIMENT NO. 3:
Implement a Message Box program and Error Expressions.

Page 1 of 6
3. Implement program to generate the result of any arithmetic
operation using msgbox()

Public Class Form1


Dim a, b, c As Integer
Private Sub Button1_Click(sender As System.Object, e As
System.EventArgs) Handles Button1.Click
a = TextBox1.Text
b = TextBox2.Text
c = a + b
TextBox3.Text = c
End Sub

Private Sub Button2_Click(sender As System.Object, e As


System.EventArgs) Handles Button2.Click
a = TextBox1.Text
b = TextBox2.Text
c = a - b
TextBox3.Text = c
End Sub

Private Sub Button3_Click(sender As System.Object, e As


System.EventArgs) Handles Button3.Click
a = TextBox1.Text
b = TextBox2.Text
c = a * b
TextBox3.Text = c
End Sub

Private Sub Button4_Click(sender As System.Object, e As


System.EventArgs) Handles Button4.Click
a = TextBox1.Text
b = TextBox2.Text
c = a / b
TextBox3.Text = c
End Sub
End Class

Page 2 of 6
Results (Output of the program):

Page 3 of 6
Page 4 of 6
4. WAP using InputBox(), MsgBox() & perform various
arithmetic expression

• Program Code:

Module Module1
Dim a, b, c As Integer
Sub Main()
a = InputBox("Enter First Number = ")
b = InputBox("Enter Second Number = ")
c = a + b
MsgBox("Addition is " & c)
c = a - b
MsgBox("Subtraction is " & c)
c = a * b
MsgBox("Multiplication is " & c)
c = a / b
MsgBox("Division is " & c)
End Sub
End Module

• Output:

Page 5 of 6
Page 6 of 6
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102

EXPERIMENT NO. 4:
Implement a program for If-Else control structures in VB.NET.

Input Code:

Module Module1
Sub Main()
Dim n As Integer
Console.WriteLine("SAHIL SURVE_
102")Console.WriteLine("Enter a
Number")n = Console.ReadLine()
If (n > 0) Then
Console.WriteLine("Number is Positive")
Else
Console.WriteLine("Number is Negative")
End If
Console.ReadLine()
End Sub
End Module

Results (Output of the program):

Page 1 of 6
Input Code:

Module Module1
Sub Main()
Dim a, b, c As Integer
Console.Write("Enter the values of a, b and c:")
a = Console.ReadLine()
b = Console.ReadLine()
c = Console.ReadLine()
If (a > b) Then
If (a > c) Then
Console.WriteLine("Greatest Number is:" & a)
Else
Console.WriteLine("Greatest Number is:" & c)
End If
Else
If (b > c) Then
Console.WriteLine("Greatest Number is:" & b)
Else
Console.WriteLine("Greatest Number is:" & c)
End If
End If
Console.ReadLine()
End Sub
End Module

Results (Output of the program):

Page 2 of 6
Input Code:

Module Module1
Dim i As Integer
Sub Main()
Console.WriteLine("SAHIL SURVE_
102")Console.WriteLine("Enter
Number") i = Console.ReadLine()
If ((i Mod 2) = 0) Then
Console.WriteLine("Number is Even")
Else
Console.WriteLine("Number is Odd")
End If
Console.ReadLine()
End Sub
End Module

Results (Output of the program):

Page 3 of 6
Input Code:
Module Module1
Sub Main()
Console.WriteLine("SAHIL SURVE
_102 ") Dim perc As Integer
Console.WriteLine("Enter Percentage:")
perc = Console.ReadLine()

If (perc < 40) Then


Console.WriteLine("Fail")

ElseIf ((perc > 40) And (perc < 60)) Then


Console.WriteLine("Pass Class")

ElseIf ((perc >= 60) And (perc < 75)) Then


Console.WriteLine("First Class")

ElseIf (perc >= 75) Then


Console.WriteLine("Distinction")

End If
Console.ReadLine()

End Sub
End Module

Page 4 of 6
Results (Output of the program):

Page 5 of 6
Page 6 of 6
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102

EXPERIMENT NO. 5:
Implement a program for Select Case Control Structures in VB.NET.

Input Code:

Module Module1

Sub Main()
Console.WriteLine("Sahil Surve_102")
Dim grade As String
Console.WriteLine("Enter your Grade")
grade = Console.ReadLine()
Select Case grade
Case "A"
Console.WriteLine("Well Done")
Case "B"
Console.WriteLine("Very Good")
Case "C"
Console.WriteLine("Poor")
Case "D"
Console.WriteLine("Fail")
End
End Select
Console.ReadLine()
End Sub
End Module

Page 1 of 6
Results (Output of the program):

Page 2 of 6
Page 3 of 6
Input Code:

Module Module1

Sub Main()
Console.WriteLine("Sahil Surve_102")
Dim str As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Dim numberofVowels As Integer = 0
For Each c As Char In str
Select Case c
Case "A"c, "E"c, "I"c, "O"c, "U"c
numberofVowels = numberofVowels + 1
End Select
Next
Console.WriteLine("Number of vowels:" &
numberofVowels)
Console.ReadKey()

End Sub
End Module

Results (Output of the program):

Page 4 of 6
Input Code:

Module Module1

Sub Main()
Console.WriteLine("Sahil Surve_102")
Dim N1, N2, Result, choice As Integer
Do
Console.WriteLine("Menu:- 1.Add 2.Substarct
3.Multiply 4.Divide 5.Exit")
Console.WriteLine("Enter choice: ")
choice = Console.ReadLine()
Console.WriteLine("Enter number 1: ")
N1 = Console.ReadLine()
Console.WriteLine("Enter number 2: ")
N2 = Console.ReadLine()
Select Case choice
Case 1
Result = N1 + N2
Console.WriteLine("Sum= " & Result)
Case 2
Result = N1 - N2
Console.WriteLine("Difference= " & Result)
Case 3
Result = N1 * N2
Console.WriteLine("Product= " & Result)
Case 4
Result = N1 \ N2
Console.WriteLine("Quotient= " & Result)
Result = N1 Mod N2
Console.WriteLine("Remainder= " & Result)
Case 5
Exit Sub
Case Else
Console.WriteLine("Wrong option...")

Page 5 of 6
End Select
Loop
End Sub
End Module

Results (Output of the program):

Page 6 of 6
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102

EXPERIMENT NO. 6:
Implement a program for While, Do Loops in VB.NET.

While:

Input Code:

Module Module1
Sub Main()
Console.WriteLine("SAHIL SURVE_
102")Dim a As Integer = 1
While (a < 10)
Console.WriteLine(a)
a = a + 1
End While
Console.ReadLine()
End Sub
End Module

Results (Output of the program):

Page 1 of 7
Do While:
Input:
Module Module1
Sub Main()
Console.WriteLine("SAHIL SURVE
_102")Dim a As Integer = 1
Do
Console.WriteLine(a)
a = a + 1
Loop While (a < 10)
Console.ReadLine()
End Sub
End Module

Results (Output of the program):

Page 2 of 7
Page 3 of 7
Input Code:

Module Module1
Sub Main()
Console.WriteLine("Sahil Surve_102")
Dim i, j, c As Integer
c = 0
i = 2
While (i <= 100)
j = 2
While (j < i)
If (i Mod j = 0) Then
Exit While
ElseIf (i = j + 1) Then
Console.WriteLine(i)
End If
j = j + 1
End While
i = i + 1
End While
Console.ReadLine()
End Sub
End Module

Page 4 of 7
Results (Output of the program):

Page 5 of 7
Input Code:

Module Module1

Sub Main()
Console.WriteLine("SAHIL SURVE
_102")Dim i As Integer = 1
While (i <= 50)
If ((i Mod 2) = 0) Then
Console.WriteLine(i & "EVEN")
Else
Console.WriteLine(i & "ODD")
End If
i = i + 1
End While
Console.ReadLine()
End Sub

End Module

Page 6 of 7
Results (Output of the program):

Page 7 of 7
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102

EXPERIMENT NO. 7:
Implement a program to demonstrate the use of For, For - Each Loops in
VB.Net

For Statement:

Input Code:

Module Module1

Sub Main()
Console.WriteLine("Sahil Surve_102")
' Simple example, loop from 0 to 2.
For i As Integer = 0 To 2
Console.WriteLine("I:", i)
Next
Console.ReadLine()
End Sub

End Module

Results (Output of the program):

Page 1 of 7
For Each Statement:
Input Code:
Module Module1
Sub Main()
Console.WriteLine("Sahil Surve_102")
Dim anArray() As Integer = {1, 3, 5, 7, 9}
Dim arrayItem As Integer
'displaying the values
For Each arrayItem In anArray
Console.WriteLine(arrayItem)
Next
Console.ReadLine()
End Sub
End Module

Results (Output of the program):

Page 2 of 7
Output:

Page 3 of 7
Input Code:

Module Module1
Sub Main()
Console.WriteLine("SAHIL SURVE_
102")Dim i As Single
For i = 3.5F To 8.5F Step 0.5F
Console.WriteLine(i)
Next
Console.ReadKey()
End Sub
End Module

Output:

Page 4 of 7
Page 5 of 7
Input Code:

Module Module1
Sub Main()
Console.WriteLine("SAHIL SURVE_
102")Dim i As Integer
Console.Write("Armstrong Numbers between 1 to
500: ")
For i = 1 To 500 Step 1
Dim sum, num, digit As Integer
sum = 0
num = i
While (num > 0)
digit = num Mod 10
sum += (digit * digit * digit)
num = num \ 10
End While
If (sum = i) Then
Console.WriteLine(i)
End If
Next
Console.ReadLine()
End Sub
End Module

Page 6 of 7
Results (Output of the program):

Page 7 of 7
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102

EXPERIMENT NO. 8:
Design windows application using Text Box, Label & Button.

Input Code:

Public Class Form1


Private Function Factorial(ByVal num As Integer) As Long
Dim fact As Long = 1
Dim i As Integer
For i = 1 To num
fact = fact * i
Next
Factorial = fact
End Function
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click

Dim fact As Long


fact = Factorial(TextBox1.Text)
MessageBox.Show("Factorial of " & TextBox1.Text &
" is " & fact, "Factorial", MessageBoxButtons.OK,
MessageBoxIcon.Information)
End Sub
End Class

Page 1 of 10
Results (Output of the program):

Page 2 of 10
Page 3 of 10
Input Code:

Public Class Form1


Dim a, b, c As Integer
Private Sub Button1_Click(sender As System.Object, e As
System.EventArgs) Handles Button1.Click
a = TextBox1.Text
b = TextBox2.Text
c = a + b
TextBox3.Text = c
End Sub

Private Sub Button2_Click(sender As System.Object, e As


System.EventArgs) Handles Button2.Click
a = TextBox1.Text
b = TextBox2.Text
c = a - b
TextBox3.Text = c
End Sub

Private Sub Button3_Click(sender As System.Object, e As


System.EventArgs) Handles Button3.Click
a = TextBox1.Text
b = TextBox2.Text
c = a * b
TextBox3.Text = c
End Sub

Private Sub Button4_Click(sender As System.Object, e As


System.EventArgs) Handles Button4.Click
a = TextBox1.Text
b = TextBox2.Text
c = a / b
TextBox3.Text = c
End Sub
End Class

Page 4 of 10
Output:

Page 5 of 10
Page 6 of 10
Input Code:

Public Class Form1

Private Sub Button1_Click(sender As System.Object, e As


System.EventArgs) Handles Button1.Click
Me.BackColor = Color.Green
End Sub

Private Sub Button2_Click(sender As System.Object, e As


System.EventArgs) Handles Button2.Click
Me.BackColor = Color.Red
End Sub

Private Sub Button3_Click(sender As System.Object, e As


System.EventArgs) Handles Button3.Click
Me.BackColor = Color.Blue
End Sub
End Class

Page 7 of 10
Results (Output of the program):

Page 8 of 10
Page 9 of 10
Page 10 of 10
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102

EXPERIMENT NO. 9:
Design windows application using Radio Button & Check Box.

Input Code:

Public Class Form1


Private Sub RadioButton1_CheckedChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
RadioButton1.CheckedChanged
If RadioButton1.Checked = True Then
MsgBox("You have selected MUMBAI")
End If
End Sub

Private Sub RadioButton2_CheckedChanged(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
RadioButton2.CheckedChanged
If RadioButton2.Checked = True Then
MsgBox("You have selected PUNE")
End If
End Sub

Private Sub RadioButton3_CheckedChanged(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
RadioButton3.CheckedChanged
If RadioButton3.Checked = True Then
MsgBox("You have selected DELHI")
End If
End Sub

Page 1 of 10
Private Sub CheckBox1_CheckedChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
CheckBox1.CheckedChanged
MessageBox.Show("You have selected KOLKATA")
End Sub

Private Sub CheckBox2_CheckedChanged(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
CheckBox2.CheckedChanged
MessageBox.Show("You have selected KERALA")

End Sub
End Class

Results (Output of the program):

Page 2 of 10
Page 3 of 10
Page 4 of 10
Input Code:

Public Class Form1

Private Sub RadioButton1_CheckedChanged(sender As


System.Object, e As System.EventArgs) Handles
RadioButton1.CheckedChanged
PictureBox1.Show()
PictureBox2.Hide()
End Sub

Private Sub RadioButton2_CheckedChanged(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
RadioButton2.CheckedChanged
PictureBox2.Show()
PictureBox1.Hide()
End Sub
End Class

Page 5 of 10
Results (Output of the program):

Page 6 of 10
Page 7 of 10
Input Code:

Public Class Form1

Private Sub RadioButton1_CheckedChanged(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
RadioButton1.CheckedChanged
Label3.ForeColor = Color.Blue
End Sub

Private Sub RadioButton2_CheckedChanged(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
RadioButton2.CheckedChanged
Label3.ForeColor = Color.Red
End Sub

Private Sub RadioButton3_CheckedChanged(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
RadioButton3.CheckedChanged
Label3.ForeColor = Color.Green
End Sub
End Class

Page 8 of 10
Results (Output of the program):

Page 9 of 10
Page 10 of 10
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102

EXPERIMENT NO. 10:


Design windows application using List Box & Combo Box.

Input Code:

Public Class Form1


Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
ListBox1.Items.Add(TextBox1.Text)
End Sub

Private Sub Button2_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button2.Click
ListBox1.Items.Remove(TextBox1.Text)
End Sub
End Class

Results (Output of the program):

Page 1 of 8
Input Code:

Public Class Form1

Private Sub Form1_Load(sender As System.Object, e As


System.EventArgs) Handles MyBase.Load
ListBox1.SelectionMode = SelectionMode.MultiSimple
ListBox1.Items.Add("C")
ListBox1.Items.Add("C++")
ListBox1.Items.Add("JAVA")
ListBox1.Items.Add("VB.NET")
ListBox1.Items.Add("PHP")
ListBox1.Items.Add("Python")

End Sub
End Class

Results (Output of the program):

Page 2 of 8
Input Code:

Public Class Form1

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender


As System.Object, ByVal e As System.EventArgs) Handles
ComboBox1.SelectedIndexChanged
MsgBox(ComboBox1.SelectedItem.ToString)
End Sub

Private Sub Form1_Load(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles MyBase.Load
ComboBox1.Items.Add("Dr. Babasaheb Ambedkar
Technological University")
ComboBox1.Items.Add("Bhavan’s Pranlal Devkaran
Nanjee College")
ComboBox1.Items.Add("Thakur Polytechnic")
ComboBox1.Items.Add("L & T Institute of Technology")
End Sub
End Class

Page 3 of 8
Results (Output of the program):

Page 4 of 8
Page 5 of 8
Input Code:

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles MyBase.Load
ComboBox1.Items.Add("First Semester")
ComboBox1.Items.Add("Second Semester")
ComboBox1.Items.Add("Third Semester")
ComboBox1.Items.Add("Fourth Semester")
End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender


As System.Object, ByVal e As System.EventArgs) Handles
ComboBox1.SelectedIndexChanged
If (ComboBox1.SelectedIndex = 0) Then
ListBox1.Items.Clear()
ListBox1.Items.Add("Chemistry")
ListBox1.Items.Add("Physics")
ListBox1.Items.Add("Maths")
ListBox1.Items.Add("English")
ElseIf (ComboBox1.SelectedIndex = 1) Then
ListBox1.Items.Clear()
ListBox1.Items.Add("PIC")
ListBox1.Items.Add("Applied Maths")
ListBox1.Items.Add("CPH")
ListBox1.Items.Add("WPD")
ElseIf (ComboBox1.SelectedIndex = 2) Then
ListBox1.Items.Clear()
ListBox1.Items.Add("DBMS")
ListBox1.Items.Add("OOP")
ListBox1.Items.Add("CGR")
ListBox1.Items.Add("DSU")
Else

Page 6 of 8
ListBox1.Items.Clear()
ListBox1.Items.Add("JPR")
ListBox1.Items.Add("DCC")
ListBox1.Items.Add("GAD")
ListBox1.Items.Add("SEN")
End If
End Sub
End Class

Results (Output of the program):

Page 7 of 8
Page 8 of 8
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102

EXPERIMENT NO. 11:


Design windows application using Picture Box & Panel.

Input Code:

Public Class Form1

Private Sub ToolStripButton1_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
ToolStripButton1.Click
Panel1.BackColor = Color.Red
End Sub

Private Sub ToolStripButton2_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
ToolStripButton2.Click
Panel1.BackColor = Color.Green
End Sub
End Class

Page 1 of 8
Results (Output of the program):

Page 2 of 8
Page 3 of 8
Page 4 of 8
Input Code:

Public Class Form1

Private Sub Form1_Load(sender As System.Object, e As


System.EventArgs) Handles MyBase.Load
PictureBox1.ImageLocation = "C:\Users\SAHIL
SURVE\Pictures\GAD-EXP 11-XIV. 1.jpg"
End Sub
End Class

Results (Output of the program):

Page 5 of 8
Page 6 of 8
Input Code:

Public Class Form1

Private Sub Form3_Load(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub Button1_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button1.Click
Dim dynamicPanel As New Panel()
dynamicPanel.Name = "Panel1"
dynamicPanel.Size = New System.Drawing.Size(228,
200)
dynamicPanel.BackColor = Color.Blue
Dim textBox1 As New TextBox()
textBox1.Location = New Point(10, 10)
textBox1.Text = "Enter Your Name"
Dim checkbox1 As New CheckBox()
checkbox1.Location = New Point(10, 50)
checkbox1.Text = "MALE"
checkbox1.Size = New Size(200, 30)
Dim checkbox2 As New CheckBox()
checkbox2.Location = New Point(10, 90)
checkbox2.Text = "FEMALE"
checkbox2.Size = New Size(200, 30)
dynamicPanel.Controls.Add(textBox1)
dynamicPanel.Controls.Add(checkbox1)
dynamicPanel.Controls.Add(checkbox2)
Controls.Add(dynamicPanel)
End Sub
End Class

Page 7 of 8
Results (Output of the program):

Page 8 of 8
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102

EXPERIMENT NO. 12:


Design windows application using Tab Control &Timer.

Input Code:

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = "Button from FY has been clicked"
End Sub

Private Sub Button2_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button2.Click
Label1.Text = "Button from SY has been clicked"

End Sub
End Class

Page 1 of 6
Results (Output of the program):

Page 2 of 6
Page 3 of 6
Input Code:

Public Class Form2

Private Sub Form2_Load(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = True
Timer1.Interval = 500
PictureBox1.Visible = True
PictureBox2.Visible = False
PictureBox3.Visible = False
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Timer1.Tick
If PictureBox1.Visible = True Then
PictureBox1.Visibe = False
PictureBox2.Visible = True
PictureBox3.Visible = False
ElseIf PictureBox2.Visible = True Then
PictureBox1.Visible = False
PictureBox2.Visible = False
PictureBox3.Visible = True
Else
PictureBox1.Visible = True
PictureBox2.Visible = False
PictureBox3.Visible = False
End If End Sub

Private Sub Button1_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Stop()
End Sub
End Class

Page 4 of 6
Results (Output of the program):

Page 5 of 6
Input Code:
Public Class Form3

Private Sub Form1_Load(ByVal sender As Object, ByVal e


As EventArgs) Handles MyBase.Load
TabPage1.Text = "FY"
TabPage2.Text = "SY"
End Sub

Private Sub Button1_Click(ByVal sender As Object, ByVal


e As EventArgs) Handles Button1.Click
TabControl1.TabPages.Add("TY")
End Sub
End Class

Results (Output of the program):

Page 6 of 6
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102

EXPERIMENT NO. 13 & 14:


Implement a Windows application to Perform Validation on various
controls.

Input Code:

Imports System.Text.RegularExpressions
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button1.Click
Dim regex As Regex = New Regex("^[789]\d{9}$")
Dim isValid As Boolean =
regex.IsMatch(TextBox1.Text)
If isValid Then
ErrorProvider1.SetError(TextBox1, "Valid")
Else
ErrorProvider1.SetError(TextBox1, "InValid")
End If

End Sub
End Class

Page 1 of 9
Results (Output of the program):

Page 2 of 9
Page 3 of 9
Input Code:

Imports System.Text.RegularExpressions
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button1.Click
Dim exp As New Regex("\S\ds{1,2}(\|-|\.\d{1,2} (\|-
|)\.)d{2}|\d{4}$")
If exp.IsMatch(TextBox1.Text) Then
ErrorProvider1.SetError(sender, "")
MessageBox.Show("VALIDATION SUCCESSFUL")
Else
ErrorProvider1.SetError(sender, "enter proper
date")
End If

End Sub
End Class

Page 4 of 9
Results (Output of the program):

Page 5 of 9
Input Code:

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = "" Then
ErrorProvider1.SetError(TextBox1, "Please Enter
Your UserName")
Else
ErrorProvider1.SetError(TextBox1, "")
End If
If TextBox2.Text = "" Then
ErrorProvider1.SetError(TextBox2, "Please Enter
Your Password")
Else
ErrorProvider1.SetError(TextBox2, "")
End If

End Sub
End Class

Page 6 of 9
Results (Output of the program):

Page 7 of 9
Input Code:

Imports System.Text.RegularExpressions
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Dim number As New Regex("\d{10}")
If number.IsMatch(TextBox1.Text) Then
ErrorProvider1.SetError(TextBox1, "")
MsgBox("Valid Phone Number")
Else
ErrorProvider1.SetError(TextBox1, "Invalid Phone
Number")
End If
Dim regex As Regex = New Regex("^([\w-\.]+)@((\[[0-
9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-
Z]{2,4}|[0-9]{1,3})(\]?)$")
Dim isValid As Boolean =
Regex.IsMatch(TextBox2.Text.Trim)
If Not isValid Then
ErrorProvider1.SetError(TextBox2, "Invalid E-
mail ID")
Else
ErrorProvider1.SetError(TextBox2, "")
MsgBox("Valid E-Mail ID")
End If
End Sub
End Class

Page 8 of 9
Results (Output of the program):

Page 9 of 9
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102

EXPERIMENT NO. 15:


Implement a Windows application using SubProcedures & Parameterized
Sub-Procedures.

Input Code:

Module Module1
Sub Main()
Console.WriteLine("SAHIL SURVE_
102")displayMsg()
Dim a, b As Integer
Console.WriteLine("Enter first number")
a = Console.ReadLine()
Console.WriteLine("Enter second number")
b = Console.ReadLine()
add(a, b)
Console.ReadLine()
End Sub
Sub displayMsg()
Console.WriteLine("Use of sub-procedure")
End Sub
Sub add(ByVal a As Integer, ByVal b As Integer)
Console.WriteLine("Addition = " & a + b)
End Sub
End Module

Page 1 of 7
Results (Output of the program):

Page 2 of 7
Page 3 of 7
Input Code:

Module Module1

Sub Main()
Console.WriteLine("SAHIL SURVE
_102")Dim num As Integer
Console.WriteLine("Enter the number from which you
want to start decrementing numbers till 1.")
num = Console.ReadLine()
natural(num)
Console.ReadLine()
End Sub
Sub natural(ByVal n As Integer)
If (n < 1) Then
Exit Sub
End If
Console.WriteLine(n)
natural(n - 1)
End Sub
End Module

Results (Output of the program);

Page 4 of 7
Input Code:
Module Module1
Sub Main()
Console.WriteLine("SAHIL SURVE
_102")Fibonacci(10)
Console.ReadLine()
End Sub
Sub Fibonacci(ByVal n As Integer)
Dim a As Integer = 0
Dim b As Integer = 1
Dim i As Integer
For i = 0 To n - 1
Dim temp As Integer
temp = a
a = b
b = temp + b
Console.WriteLine(a)
Next
End Sub
End Module

Results (Output of the program):

Page 5 of 7
Input Code:

Module Module1
Sub Main()
Dim num As Integer
Console.WriteLine("Enter number")
num = Console.ReadLine()
reverse(num)
Console.ReadLine()
End Sub
Sub reverse(ByVal num As Integer)
Dim number = num
Dim result As Integer
While number > 0
num = number Mod 10
result = result * 10 + num
number = number \ 10
End While
Console.WriteLine("Reverse is:" & result)
End Sub
End Module

Page 6 of 7
Results (Output of the program):

Page 7 of 7
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102

EXPERIMENT NO. 16:


Implement a Program to Demonstrate Use of Simple Function &
Parameterized Functions.

Input Code:

Module Module1
Sub Main()
Dim a, b As Integer
show()
Console.WriteLine("Enter two numbers")
a = Console.ReadLine()
b = Console.ReadLine()
Console.WriteLine("Addition = " & add(a, b))
Console.ReadLine()
End Sub
Public Function show()
Console.WriteLine("This is simple function")
Return Nothing
End Function
Public Function add(ByVal n1 As Integer, ByVal n2 As
Integer)
Return (n1 + n2)
End Function
End Module

Page 1 of 6
Results (Output of the program):

Page 2 of 6
Page 3 of 6
Input Code:

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button1.Click
Dim a, b As Integer
Dim res As Integer
a = Val(TextBox1.Text)
b = Val(TextBox2.Text)
res = findmax(a, b)
MsgBox("Maximum Number is " & res)
End Sub
Private Function findmax(ByVal num1 As Integer, ByVal
num2 As Integer)
Dim result As Integer
If (num1 > num2) Then
result = num1
Else
result = num2
End If
findmax = result
End Function
End Class

Page 4 of 6
Results (Output of the program):

Page 5 of 6
Input Code:
Module Module1
Sub Main()
Dim n As Integer
Console.WriteLine("Enter number")
n = Console.ReadLine()
Console.WriteLine("Factorial of " & n & " is " &
fact(n))
Console.ReadLine()
End Sub
Public Function fact(ByVal n As Integer)
If n = 0 Then
fact = 1
Else
fact = n * fact(n - 1)
End If
End Function
End Module

Results (Output of the program):

Page 6 of 6
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102

EXPERIMENT NO. 17:


Understand the Concept of Class and Object of Class.

Input Code:

Module Module1
Sub Main()
Console.WriteLine("Sahil Surve_102")
Dim obj As New test
obj.disp()
Console.ReadLine()
End Sub
End Module
Public Class test
Sub disp()
Console.WriteLine("Welcome to VB.NET")
End Sub
End Class

Results (Output of the program):

Page 1 of 7
Output:

Page 2 of 7
Errors:
Type B is not defined
Display is not declared. It may be inaccessible due to its protection level.
Type C is not defined
Display is not declared. It may be inaccessible due to its protection level.

Page 3 of 7
Input Code:

Module Module1
Sub Main()
Dim obj As Box = New Box()
Dim vol As Integer
vol = obj.volume(2, 4, 4)
Console.WriteLine("Length = " & obj.l)
Console.WriteLine("Breadth = " & obj.b)
Console.WriteLine("Height = " & obj.h)
Console.WriteLine("Volume = " & vol)
Console.ReadLine()
End Sub
End Module
Class Box
Public l, b, h As Integer
Function volume(ByVal i As Integer, ByVal j As Integer,
ByVal k As Integer)
Dim v As Integer
l = i
b = j
h = k
v = l * b * h
Return v
End Function
End Class

Page 4 of 7
Results (Output of the program):

Page 5 of 7
Input Code:
Public Class Form1

Private Sub Form1_Load(sender As System.Object, e As


System.EventArgs) Handles MyBase.Load
ComboBox1.Items.Add(10)
ComboBox1.Items.Add(15)
ComboBox1.Items.Add(20)
ComboBox1.Items.Add(20)
ComboBox1.Items.Add(87)
ComboBox2.Items.Add(60)
ComboBox2.Items.Add(98)
ComboBox2.Items.Add(27)
ComboBox2.Items.Add(9)
ComboBox2.Items.Add(1)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Dim average As Single
average = (Val(ComboBox1.Text) +
Val(ComboBox2.Text)) / 2
MsgBox("Average: " & average)
End Sub
End Class

Page 6 of 7
Results (Output of the program):

Page 7 of 7
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102

EXPERIMENT NO. 18:


Implement a program for Class Constructor and Destructor to De-Allocate
Memory.

Use of Constructor:
Input Code:

Module Module1

Sub Main()
Console.WriteLine("Sahil Surve_102")
Dim obj As New syco
obj.show()
Console.ReadLine()
End Sub
Public Class syco
Public Function show()
Console.WriteLine("This is base class")
Return Nothing
End Function
Sub New()
Console.WriteLine("Constructor Executed")
End Sub
End Class
End Module

Page 1 of 7
Results (Output of the program):

Use of Destructor:
Input Code:

Module Module2
Sub main()
Console.WriteLine("Sahil Surve_102")
Dim obj As New syco
obj.show()
End Sub
End Module
Public Class syco
Public Function show()
Console.WriteLine("This is base class")
Return Nothing
End Function
Protected Overrides Sub finalize()
Console.WriteLine("Destructor executing here")
Console.ReadLine()
End Sub
End Class

Page 2 of 7
Results (Output of the program):

Page 3 of 7
Output:

Page 4 of 7
Errors:
Variable finalize conflics with the sub finalize in the base class ‘object’ and should
be declared shadows.
Declaration expected.

Overrides is not on a member variable declaration.


End sub must be preceded by a matching ‘sub’.

Page 5 of 7
Input Code:

Module Module1
Sub main()
Console.WriteLine("SAHIL SURVE
_102")Dim obj As New sample
obj.display()
Console.ReadLine()
End Sub
End Module
Class sample
Public Sub New()
Console.WriteLine("This is Constructor")
End Sub
Sub display()
Console.WriteLine("This is Method")
End Sub
End Class

Results (Output of the program):

Page 6 of 7
Input Code:
Module Module1
Sub main()
Dim obj As New Circle(2)
obj.area()
Console.ReadLine()
End Sub
End Module
Class Circle
Dim p As Double = 3.14
Dim r, a As Double
Public Sub New(ByVal i As Integer)
r = i
End Sub
Sub area()
a = p * r * r
Console.WriteLine("Area of Circle = " & a)
End Sub
End Class

Results (Output of the program):

Page 7 of 7
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102

EXPERIMENT NO. 19:


Develop a Program for Inheritance.

Input Code:

Module Module1

Sub Main()
Dim obj As New details
obj.show()
Console.ReadLine()
End Sub
End Module
Public Class student
Public branch As String = "Computer"
End Class
Public Class details
Inherits student
Public Function show()
Console.WriteLine("Branch = " & branch)
Return 0
End Function
End Class

Page 1 of 5
Results (Output of the program):

Page 2 of 5
Output:

Page 3 of 5
Errors:
Module statement must end with a matching ‘End Module’.
Sub Main was not found.
End of statement expected.

Page 4 of 5
Input Code:

Module Module1
Sub Main()
Dim s As New student
s.branch()
s.year()
Console.ReadLine()
End Sub
End Module
Class faculty
Dim b As String = "Computer"
Sub branch()
Console.WriteLine("Branch = " & b)
End Sub
End Class
Class student
Inherits faculty
Dim y As String = "Second Year"
Sub year()
Console.WriteLine("Year = " & y)
End Sub
End Class

Results (Output of the program):

Page 5 of 5
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102

EXPERIMENT NO. 20 & 21:


Implement a Program for Overloading & overriding.

Method Overloading
Input Code:

Module Module1
Sub Main()
Dim res As New addition
Console.WriteLine("Overloaded Values of Class
addition")
Console.WriteLine(res.add(10))
Console.WriteLine(res.add(35, 25))
Console.ReadLine()
End Sub
End Module
Public Class addition
Public i, j As Integer
Public Function add(ByVal i As Integer) As Integer
Return i
End Function
Public Function add(ByVal i As Integer, ByVal j As
Integer) As Integer
Return i + j
End Function
End Class

Page 1 of 7
Results (Output of the program):

Page 2 of 7
Method Overriding
Input Code:

Module Module1
Sub Main()
Dim obj As New child
Dim result As Integer
result = obj.add(10, 5)
Console.WriteLine("Overrriding Values of Class
addition")
Console.WriteLine("Result = " & result)
Console.ReadLine()
End Sub
End Module
Public Class parent
Public Overridable Function add(ByVal i As Integer,
ByVal j As Integer)
Return (i + j)
End Function
End Class
Public Class child
Inherits parent
Public Overrides Function add(ByVal i As Integer, ByVal
j As Integer)
Console.WriteLine("Result of Addition = " &
MyBase.add(12, 20))
Return (i + j)
End Function
End Class

Page 3 of 7
Results (Output of the program):

Page 4 of 7
Output:

Page 5 of 7
Input Code:

Module Module1
Sub main()
Console.WriteLine("SAHIL SURVE
_102")Dim obj As New EmpInfo
obj.getInfo()
obj.showInfo()
Console.ReadLine()
End Sub
End Module
Public Class EmpPersonalDetails
Dim name As String
Dim address As String
Public Overridable Function getInfo()
Console.WriteLine("Enter Name of Employee")
name = Console.ReadLine()
Console.WriteLine("Enter Address of Employee")
address = Console.ReadLine()
Return Nothing
End Function
Public Overridable Function showInfo()
Console.WriteLine("Employee Name:" & name)
Console.WriteLine("Employee Address:" & address)
Return Nothing
End Function
End Class
Public Class EmpInfo
Inherits EmpPersonalDetails
Dim EmpId As Integer
Dim salary As Integer
Dim joinDate As Date
Public Overrides Function getInfo()
MyBase.getInfo()
Console.WriteLine("Enter employee id of employee")

Page 6 of 7
EmpId = Console.ReadLine()
Console.WriteLine("Enter Salary of employee")
salary = Console.ReadLine()
Console.WriteLine("Enter Join Date")
joinDate = Console.ReadLine()
Return Nothing
End Function
Overrides Function showInfo()

Console.WriteLine("*****************************************
**************************************")
Console.WriteLine("Employee Details are as follows")
MyBase.showInfo()
Console.WriteLine("Employee ID:" & EmpId)
Console.WriteLine("Employee Salary:" & salary)
Console.WriteLine("Employee Joining Date:" &
joinDate)
Return Nothing
End Function
End Class

Results (Output of the program):

Page 7 of 7
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102

EXPERIMENT NO. 22:


Implement a Program to Demonstrate Shadowing in Inheritance.

Input Code:

Module Module1
Sub Main()
Dim p As New parent
Dim c As New child
p.use()
c.use()

Console.WriteLine("*****************************************
*******************************")
p.disp()
c.disp()
Console.ReadLine()
End Sub
Public Class parent
Public Sub disp()
Console.WriteLine("Parent")
End Sub
Public Sub use()
Me.disp()
End Sub
End Class
Public Class child
Inherits parent
Public Shadows Sub disp()
Console.WriteLine("Child")

Page 1 of 6
End Sub
End Class
End Module

Results (Output of the program):

Page 2 of 6
Output:

Page 3 of 6
Output:

Page 4 of 6
Input Code:

Module Module1
Dim f As New first
Dim s As New Second
Dim t As New third
Sub Main()
f.display()
s.display()
t.display()
Console.ReadLine()
End Sub
End Module
Public Class first
Public Sub display()
Console.WriteLine("This is First Year")
End Sub
End Class
Public Class second
Inherits first
Private Shadows Sub display()
Console.WriteLine("This is Second Year")
End Sub
End Class
Public Class third
Inherits second
Public Shadows Sub display()
Console.WriteLine("This is Third Year")
End Sub
End Class

Page 5 of 6
Results (Output of the program):

Page 6 of 6
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102

EXPERIMENT NO. 23:


Implement a program to handle runtime errors using Exception handling.

Input Code:

Public Class Form1


Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Dim num1, num2, div As Integer
num1 = Val(TextBox1.Text)
num2 = Val(TextBox2.Text)
Try
div = num1 / num2
MsgBox("Division is " & div)
Catch ex As OverflowException
MsgBox(ex.ToString())
End Try
End Sub
End Class

Page 1 of 6
Results (Output of the program):

Page 2 of 6
Output:

Page 3 of 6
Output:

Page 4 of 6
Input Code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Try
If TextBox1.Text = "" Or TextBox2.Text = "" Then
Throw (New Exception("Fill Data"))
Else
MsgBox(TextBox1.Text & TextBox2.Text)
End If
Catch ex As Exception
MsgBox(ex.ToString)
Finally
MsgBox("Thank You")
End Try
End Sub
End Class

Page 5 of 6
Results (Output of the program):

Page 6 of 6
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102

EXPERIMENT NO. 24:


Understand The Concept Of Ado.Net.

Input Code:
Imports System.Data
Imports System.Data.OleDb
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
Dim conn As New

OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\Users\Sahil\Documents\Visual Studio
2010\Projects\GADExp24\GADExp24\bin\Debug\GADExp24.accdb")
conn.Open()
Dim cmd As New OleDbCommand("Select * From Marks", conn)
Dim da As New OleDbDataAdapter(cmd)
Dim ds As New
DataSet da.Fill(ds, "Marks"))
DataGridView1.DataSource = ds
102DataGridView1.DataMember =
"Marks"
End Sub
End Class

Page 1 of 5
Results (Output of the program):

Page 2 of 5
Page 3 of 5
Input Code:

Imports System.Data
Imports System.Data.OleDb
Public Class Form2
Private Sub Form2_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
Dim conn As New

OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\Users\user\OneDrive\Documents\GAD_EXP_24.accdb")
conn.Open()
Dim cmd As New OleDbCommand("Select * From MARKS",
conn)
Dim da As New OleDbDataAdapter(cmd)
Dim ds As New DataSet
da.Fill(ds, "MARKS")
DataGridView1.DataSource = ds
DataGridView1.DataMember = "MARKS"
End Sub
End Class

Page 4 of 5
Results (Output of the program):

Page 5 of 5
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102

EXPERIMENT NO. 25 & 26:


Understand The Concept of Data Adapter.

Page 1 of 6
Input Code:
Imports System.Data
Imports System.Data.OleDb
Public Class Form1
Dim cmd As OleDbCommand
Dim da As OleDbDataAdapter
Dim ds As DataSet
Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
Dim conn As New

OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\Users\user\OneDrive\Desktop\GAD EXP 25 26.accdb")
conn.Open()
cmd = New OleDbCommand("Select * From Marks", conn)
da = New OleDbDataAdapter(cmd)
ds = New DataSet
da.Fill(ds, "Marks")
Me.TextBox1.DataBindings.Add("text", ds, "Marks.Roll
No")
Me.TextBox2.DataBindings.Add("text", ds,
"Marks.Name")
Me.TextBox3.DataBindings.Add("text", ds,
"Marks.Marks")
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal
e As EventArgs) Handles Button1.Click
Me.BindingContext(ds, "Marks").Position = 0
End Sub
Private Sub Button2_Click(ByVal sender As Object, ByVal
e As EventArgs) Handles Button2.Click
Me.BindingContext(ds, "Marks").Position =
Me.BindingContext(ds, "Marks").Position + 1
End Sub

Page 2 of 6
Private Sub Button3_Click(ByVal sender As Object, ByVal
e As EventArgs) Handles Button3.Click
Me.BindingContext(ds, "Marks").Position =
Me.BindingContext(ds, "Marks").Count - 1
End Sub
Private Sub Button4_Click(ByVal sender As Object, ByVal
e As EventArgs) Handles Button4.Click
Me.BindingContext(ds, "Marks").Position =
Me.BindingContext(ds, "Marks").Position - 1
End Sub
End Class

Results (Output of the program):

Page 3 of 6
Page 4 of 6
Input Code:
Imports System.Data
Imports System.Data.OleDb
Public Class Form2
Dim cmd As OleDbCommand
Dim da As OleDbDataAdapter
Dim ds As DataSet
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Dim conn As New

OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\Users\user\OneDrive\Desktop\GAD EXP 25 26.accdb")
conn.Open()
Dim cmd1 As New OleDbCommand("Select * From Marks",
conn)
Dim cmd2 As New OleDbCommand("Select * From
Student", conn)
Dim da1 As New OleDbDataAdapter(cmd1)
Dim da2 As New OleDbDataAdapter(cmd2)
Dim ds As New DataSet
da1.Fill(ds, "Marks")
da2.Fill(ds, "Student")
DataGridView1.DataSource = ds
DataGridView1.DataMember = "Student"
DataGridView2.DataSource = ds
DataGridView2.DataMember = "Marks"
End Sub
End Class

Page 5 of 6
Results (Output of the program):

Page 6 of 6
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102

EXPERIMENT NO. 27:


Understand the concept of select and insert data in database table.

Input Code:
Imports System.Data
Imports System.Data.OleDb
Public Class Form1
Dim conn As OleDbConnection
Dim ds As New DataSet
Dim cmd As OleDbCommand
Dim da As OleDbDataAdapter
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
conn = New
OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\SAHIL SEM 4\GAD\Manual\GAD EXP 27.accdb")
conn.Open()
Dim insertString As String
insertString = "Insert into Student(RollNo, Name,
Marks) values('"+ txtROLLNO.Text + "','" + Txtname.Text + "'
,'" + txtMarks.Text + "')"
cmd = New OleDbCommand(insertString, conn)
cmd.ExecuteNonQuery()
MsgBox("Record Successfully Inserted")
conn.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button2.Click

Page 1 of 8
conn = New
OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\SAHIL SEM 4\GAD\Manual\GAD EXP 27.accdb")
conn.Open()
Dim deleteString As String
deleteString = "Delete From student where RollNo ='"
+ txtRollno.Text + "'"
Dim cmd As New OleDbCommand(deleteString, conn)
cmd.ExecuteNonQuery()
MsgBox(" Record Successfully Deleted")
conn.Close()
End Sub
Private Sub Button3_Click(ByVal sender As Object, ByVal
e As EventArgs) Handles Button3.Click
Dim con As New

OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\SAHIL SEM 4\GAD\Manual\GAD EXP 27.accdb")
con.Open()
Dim cmd As New OleDbCommand("Select * From student",
con)
Dim da As New OleDbDataAdapter(cmd)
da.Fill(ds, "student")
DataGridView1.DataSource = ds
DataGridView1.DataMember = "student"
con.Close()
End Sub
Private Sub Button4_Click(ByVal sender As Object, ByVal
e As EventArgs) Handles Button4.Click
Close()
End Sub

Page 2 of 8
Results (Output of the program):

Page 3 of 8
Page 4 of 8
Input Code:
Imports System.Data
Imports System.Data.OleDb
Public Class Form2
Dim conn As OleDbConnection
Dim ds As New DataSet
Dim da As OleDbDataAdapter
Private Sub btnIns_Click(ByVal sender As Object, ByVal e
As EventArgs) Handles btnIns.Click
Dim conn As New

OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\SAHIL SEM 4\GAD\Manual\GAD EXP 27.accdb")
conn.Open()
If TextBox1.Text = "" Then
MsgBox("Please Enter Employee Number")
Else
Dim InsertString As String
InsertString = "Insert into Employee(EMPNO,
EMPNAME, ADDRESS," DATEOFJOINING) values('" + TextBox1.Text
+ "','" + txtName.Text + "' ,'" +
txtAdd.Text(+"','" + txtDOJ.Text + "')")
Dim cmd As New OleDbCommand(InsertString, conn)

Page 5 of 8
cmd.ExecuteNonQuery()
MsgBox(" Record Successfully Inserted")
TextBox1.Clear()
txtName.Clear()
txtAdd.Clear()
txtDOJ.Clear()
conn.Close()
End If
End Sub
Private Sub btnDel_Click(ByVal sender As Object, ByVal e
As EventArgs)
Handles btnDel.Click
Dim conn As New

OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\SAHIL SEM 4\GAD\Manual\GAD EXP 27.accdb")
conn.Open()
If TextBox1.Text = "" Then
MsgBox("Please Enter Employee Number")
Else
Dim DeleteString As String
DeleteString = "Delete From EMPLOYEE where EMPNO
='" +
TextBox1.Text + "'"
Dim cmd2 As New OleDbCommand(DeleteString, conn)
cmd2.ExecuteNonQuery()
MsgBox(" Record Successfully Deleted")
TextBox1.Clear()
TextBox1.Focus()
conn.Close()
End If
End Sub
Private Sub btnUpd_Click(ByVal sender As Object, ByVal e
As EventArgs) Handles btnUpd.Click
Dim conn As New

OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\SAHIL SEM 4\GAD\Manual\GAD EXP 27.accdb")

Page 6 of 8
conn.Open()
If TextBox1.Text <> "" Then
Dim UpdateString As String
UpdateString = "Update EMPLOYEE SET EMPNO ='" +
TextBox1.Text + "',EMPNAME='" + txtName.Text + "',ADDRESS='"
+ txtAdd.Text + "',DATEOFJOINING='" + txtDOJ.Text + "' Where
EMPNO ='" + TextBox1.Text +"'"
Dim cmd1 As New OleDbCommand(UpdateString, conn)
cmd1.ExecuteNonQuery()
MsgBox(" Record Successfully Updated")
TextBox1.Clear()
txtName.Clear()
txtAdd.Clear()
txtDOJ.Clear()
conn.Close()
Else
MsgBox(" Please Enter Employment Number")
End If
End Sub
Private Sub btnShow_Click(ByVal sender As Object, ByVal
e As EventArgs) Handles btnShow.Click
Dim conn As New

OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\SAHIL SEM 4\GAD\Manual\GAD EXP 27.accdb")
conn.Open()
Dim cmd As New OleDbCommand("Select * From
EMPLOYEE", conn)
Dim da As New OleDbDataAdapter(cmd)
Dim ds As New DataSet
da.Fill(ds, "EMPLOYEE")
DataGrid1.DataSource = ds
DataGrid1.DataMember = "EMPLOYEE"
conn.Close()
End Sub
Private Sub btnSearch_Click(ByVal sender As Object,
ByVal e As EventArgs) Handles btnSearch.Click
If TextBox1.Text = "" Then

Page 7 of 8
MsgBox("Please Enter Employee Number")
Else
Dim conn As New

OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\SAHIL SEM 4\GAD\Manual\GAD EXP 27.accdb")
conn.Open()
Dim cmd As New OleDbCommand("Select * From
EMPLOYEE where EMPNO like '" + TextBox1.Text + "'", conn)
Dim da As New OleDbDataAdapter(cmd)
Dim ds As New DataSet
da.Fill(ds, "EMPLOYEE")
DataGrid1.DataSource = ds.Tables("EMPLOYEE")
da.Dispose()
conn.Close()
TextBox1.Clear()
TextBox1.Focus()
End If
End Sub
End Class

Results (Output of the program):

Page 8 of 8
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102

EXPERIMENT NO. 28, 29 & 30:


Implement the Concepts of Data Binding.

Input Code:
Imports System.Data.OleDb
Class Form3
Private Sub Form1_Load(ByVal sender As Object,
ByVal e As EventArgs) Handles MyBase.Load
Dim ds As New DataSet
Dim cmd As OleDbCommand
Dim da As OleDbDataAdapter
Dim conn As
New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;
Data Source=C:\Users\Documents\GADExp28.accdb")
conn.Open()
cmd = New OleDbCommand("Select * From Marks", conn)
da = New OleDbDataAdapter(cmd) da.Fill(ds, "Marks")
TextBox1.DataBindings.Add("Text", ds, "Marks.Roll
No")
TextBox2.DataBindings.Add("Text", ds, "Marks.Name")
TextBox3.DataBindings.Add("Text", ds, "Marks.Marks")
End Sub
End Class

Page 1 of 7
Results (Output of the program):

Page 2 of 7
Page 3 of 7
Input Code:
Imports System.Data
Imports System.Data.OleDb
Public Class Form1
Dim conn As OleDbConnection
Dim cmd As OleDbCommand
Dim adpt As OleDbDataAdapter
Dim ds As New DataSet
Dim cs As CurrencyManager
Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
conn = New
OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data
Source=C:\Users\Documents\GADExp28.accdb")
conn.Open()
cmd = New OleDbCommand("Select * from stud", conn)
adpt = New OleDbDataAdapter(cmd)
adpt.Fill(ds, "STUD") ds = New DataSet
adpt.Fill(ds, "STUD")
cs = CType(Me.BindingContext(ds, "stud"),
CurrencyManager)
TextBox1.DataBindings.Add("text", ds, "STUD.SName")
TextBox2.DataBindings.Add("text", ds,
"STUD.CollegeName")
End Sub
End Class

Page 4 of 7
Results (Output of the program):

Page 5 of 7
Input Code:
Imports System.Data
Imports System.Data.OleDb
Public Class Form2
Dim conn As OleDbConnection
Dim cmd As OleDbCommand
Dim adpt As OleDbDataAdapter
Dim ds As New DataSet
Dim cm As CurrencyManager
Private Sub Form2_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
conn = New
OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\Users\Documents\GADExp28.accdb")
conn.Open()
cmd = New OleDbCommand("Select * from bank", conn)
adpt = New OleDbDataAdapter(cmd)
adpt.Fill(ds,"bank") ds = New DataSet
adpt.Fill(ds,"bank")
cm = CType(Me.BindingContext(ds, "bank"),
CurrencyManager)
ComboBox1.dataSource = ds
ComboBox1.DisplayMember = "bank.branch"
ComboBox2.DataSource = ds
ComboBox2.DisplayMember = "bank.type"
End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
ComboBox1.SelectedIndexChanged()
If Not IsNothing(ComboBox1.SelectedItem) Then
TextBox1.Text = ComboBox1.SelectedValue.ToString
End If
End Sub

Page 6 of 7
Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ComboBox2.SelectedIndexChanged()
If Not IsNothing(ComboBox2.SelectedItem) Then
TextBox1.Text = ComboBox2.SelectedValue.ToString
End If
End Sub
End Class

Results (Output of the program):

Page 7 of 7

You might also like