GAD Full Manual
GAD Full Manual
GAD Full Manual
102 20 21
Sahil Rupesh Surve
102
COMPUTER ENGINEERING (CO)
THAKUR POLYTECHNIC
0522
20 21
Mumbai 1905220527
22/06/2021 113000
CONTENT PAGE
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.
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
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()
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
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
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
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()
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
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
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
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
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
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
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:
Page 1 of 10
Results (Output of the program):
Page 2 of 10
Page 3 of 10
Input Code:
Page 4 of 10
Output:
Page 5 of 10
Page 6 of 10
Input Code:
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:
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
End Sub
End Class
Page 2 of 10
Page 3 of 10
Page 4 of 10
Input Code:
Page 5 of 10
Results (Output of the program):
Page 6 of 10
Page 7 of 10
Input Code:
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
Input Code:
Page 1 of 8
Input Code:
End Sub
End Class
Page 2 of 8
Input Code:
Page 3 of 8
Results (Output of the program):
Page 4 of 8
Page 5 of 8
Input Code:
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
Page 7 of 8
Page 8 of 8
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102
Input Code:
Page 1 of 8
Results (Output of the program):
Page 2 of 8
Page 3 of 8
Page 4 of 8
Input Code:
Page 5 of 8
Page 6 of 8
Input Code:
End Sub
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
Input Code:
End Sub
End Class
Page 1 of 6
Results (Output of the program):
Page 2 of 6
Page 3 of 6
Input Code:
Page 4 of 6
Results (Output of the program):
Page 5 of 6
Input Code:
Public Class Form3
Page 6 of 6
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102
Input Code:
Imports System.Text.RegularExpressions
Public Class Form1
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
End Sub
End Class
Page 4 of 9
Results (Output of the program):
Page 5 of 9
Input Code:
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
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
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
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
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:
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
Page 6 of 6
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102
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
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
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
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.
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
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
Page 7 of 7
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102
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
Page 5 of 5
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102
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
Page 7 of 7
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102
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
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
Input Code:
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
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
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
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
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
Page 8 of 8
GUI APPLICATION DEVELOPMENT USING VB.NET MANUAL
Name: Sahil Surve SYCO Roll No.: 102
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
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
Page 7 of 7