1. Design VB.Net application using Existing Namespaces.
Class:
Namespace n1
Public Class Class1
Public Shared Sub d1()
Console.WriteLine("Hello World!")
End Sub
End Class
End Namespace
Module:
Imports [NameSpace]
Imports [NameSpace].n1
Module Program
Sub main()
Class1.d1()
Console.ReadLine()
End Sub
End Module
2. Design VB.Net application using User Defined Namespace.
Class:
Namespace n1
Public Class Class1
Public Shared Sub d1()
Console.WriteLine("Hello World!")
End Sub
End Class
End Namespace
Module:
Imports [NameSpace]
Imports [NameSpace].n1
Module Program
Sub main()
Class1.d1()
Console.ReadLine()
End Sub
End Module
3. Implement a Message Box program & Arithmetic Expressions.
Module Program
Sub Main(args As String())
Dim a, b, c As Integer
a = InputBox("A =")
b = InputBox("B =")
c = a + b
Msgbox("C =" + c.ToString)
End Sub
End Module
4. Implement a program for If-Else control structures in VB.Net.
Imports System
Module Program
Sub Main(args As String())
Dim A, B As Integer
Console.WriteLine("A =")
A = Console.ReadLine()
Console.WriteLine("B =")
B = Console.ReadLine()
If A > B Then
Console.WriteLine("A is largest")
Console.ReadLine()
Else
Console.WriteLine("B is largest")
Console.ReadLine()
End If
End Sub
End Module
5. Implement a program for select case control structures in VB.Net.
Imports System
Imports System.Transactions
Module Program
Sub Main(args As String())
Dim Ans As Integer
Console.WriteLine("1.ADDITION")
Console.WriteLine("2.SUBSTRACTION")
Console.WriteLine("Select Case :")
Ans = Console.ReadLine()
Select Case Ans
Case 1
Dim a, b, c As Integer
Console.WriteLine("Enter A =")
a = Console.ReadLine()
Console.WriteLine("Enter B =")
b = Console.ReadLine()
c = a + b
Console.WriteLine("C =" + c.ToString)
Console.ReadLine()
Case 2
Dim a, b, c As Integer
Console.WriteLine("Enter A =")
a = Console.ReadLine()
Console.WriteLine("Enter B =")
b = Console.ReadLine()
c = a - b
Console.WriteLine("C =" + c.ToString)
Console.ReadLine()
End Select
End Sub
End Module
6. Implements a program for While, DO Loops in VB.Net.
(While loop)
Module Program
Sub Main(args As String())
Dim n As Integer
n = 1
While n <= 10
Console.WriteLine(n)
n = n + 1
End While
Console.ReadLine()
End Sub
End Module
(Do-While loop)
Module Program
Sub Main(args As String())
Dim n As Integer
n = 1
Do While n <= 10
Console.WriteLine(n)
n = n + 1
Loop
Console.ReadLine()
End Sub
End Module
7. Implement a program to use of For, For-Each Loops In VB.Net.
(For loop)
Module Program
Sub Main(args As String())
Dim n As Integer
For n = 2 To 10 Step 2
Console.WriteLine(n)
Next
Console.ReadLine()
End Sub
End Module
(For-Each loop)
Module Program
Sub Main(args As String())
Dim Arr() As Integer = {10, 4, 6}
Dim n As Integer
For Each n In Arr
Console.WriteLine(n)
Next
Console.ReadLine()
End Sub
End Module
8. Design windows application using Text Box, Label & Button.
Public Class Form1
Private Sub Button1_Click(sender As Object, e As
EventArgs) Handles Button1.Click
Dim r As Integer
r = Val(TextBox1.Text) + Val(TextBox2.Text)
MsgBox("Addition =" + r.ToString)
End Sub
End Class
9. Design windows application using Radio Button & Check Box.
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs)
Handles Button1.Click
If CheckBox1.Checked Then
MsgBox("under 18")
Else
MsgBox("above 18")
End If
End Sub
Private Sub RadioButton1_CheckedChanged(sender As Object, e
As EventArgs) Handles RadioButton1.CheckedChanged
Button1.Enabled = RadioButton1.Checked
End Sub
End Class
10. Design windows application using List Box & Combo Box.
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs)
Handles Button1.Click
Label1.Text = "Subject :" & ListBox1.SelectedItem &
"class :" & ComboBox1.SelectedItem
End Sub
End Class
11. Design windows application using Picture Box & Panel
Public Class Form1
Private Sub RadioButton1_CheckedChanged(sender As Object, e
As EventArgs) Handles RadioButton1.CheckedChanged
PictureBox1.Image = My.Resources.SEN_DFD
End Sub
Private Sub RadioButton2_CheckedChanged(sender As Object, e
As EventArgs) Handles RadioButton2.CheckedChanged
PictureBox1.Image = My.Resources.Exp_8
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs)
Handles Button1.Click
Panel1.BackColor = Color.Red
End Sub
End Class
12. Design windows application using Tab Control & Timer.
(Tab Control )
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs)
Handles Button1.Click
Dim r As Integer
r = Val(TextBox1.Text) + Val(TextBox2.Text)
MsgBox("Add =" + r.ToString)
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs)
Handles Button2.Click
Dim r As Integer
r = Val(TextBox1.Text) - Val(TextBox2.Text)
MsgBox("sub =" + r.ToString)
End Sub
End Class
13. Implement a Windows application to perform Validation.
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs)
Handles Button1.Click
If DateTimePicker1.Value < Date.Today Then
MsgBox("Valid")
Else
MsgBox("Date can not be able from future")
End If
End Sub
End Class
14. Implement a Windows application using Sub-Procedures
& Parameterized Sub-Procedures
(paramiterized)
Imports System
Module Program
Sub Main(args As String())
ADD(10, 20)
End Sub
Sub ADD(x As Integer, y As Integer)
Dim a, b, c As Integer
a = x
b = y
c = a + b
Console.WriteLine("Add =" + c.ToString)
End Sub
End Module
(default)
Imports System
Module Program
Sub Main(args As String())
ADD()
End Sub
Sub ADD()
Dim a, b, c As Integer
Console.WriteLine("A =")
a = Console.ReadLine()
Console.WriteLine("B =")
b = Console.ReadLine()
c = a + b
Console.WriteLine("Add =" + c.ToString)
End Sub
End Module
15. Implement a program to demonstrate Use of Simple Functions.
(default)
Imports System
Module Program
Function ADD()
Dim a, b, c As Integer
Console.WriteLine("A =")
a = Console.ReadLine()
Console.WriteLine("B =")
b = Console.ReadLine()
c = a + b
Console.WriteLine("Add =" + c.ToString)
End Function
Sub Main(args As String())
ADD()
End Sub
End Module
16.Implement a program to demonstrate Use of Parameterized Functions
(paramiterized)
Imports System
Module Program
Function ADD(x As Integer, y As Integer)
Dim a, b, c As Integer
a = x
b = y
c = a + b
Console.WriteLine("Add =" + c.ToString)
End Function
Sub Main(args As String())
ADD(10, 4)
End Sub
End Module
17.Implement a program to demonstrate Use of Class and Object of Class
(class)
Public Class Class1
Public Sub Add()
Dim a, b, c As Integer
Console.WriteLine("A =")
a = Console.ReadLine()
Console.WriteLine("B =")
b = Console.ReadLine()
c = a + b
Console.WriteLine("Add =" + c.ToString)
End Sub
End Class
(module)
Module Program
Sub Main(args As String())
Dim obj = New Class1
obj.Add()
End Sub
End Module
18. Implement a program for class Constructor.
(class)
Public Class Class1
Public Sub New()
Dim a, b As Integer
a = 10
b = 20
Console.WriteLine("A =" + a.ToString)
Console.WriteLine("B =" + b.ToString)
End Sub
End Class
(module)
Module Program
Sub Main(args As String())
Dim obj1 = New Class1
Console.ReadLine()
End Sub
End Module
19.Implement a program for class Destructor to de allocate memory.
(class)
Public Class Class1
Public Sub New()
Dim a, b As Integer
Console.WriteLine(" constructer Created ")
End Sub
Protected Overrides Sub finalize()
Console.WriteLine(" destroyed ")
End Sub
End Class
(module)
Imports System
Module Program
Sub Main(args As String())
Dim obj1 = New Class1()
End Sub
End Module
20. Develop a program for Inheritance.
Imports System
Module Program
Public Class Class1
Dim no As Integer
Public Sub get1()
Console.WriteLine("Enter any 1st number :")
no = Console.ReadLine()
End Sub
Public Sub put1()
Console.WriteLine("your 1st number is :" +
no.ToString)
End Sub
End Class
Public Class class2 : Inherits Class1
Dim num As Integer
Public Sub get2()
Console.WriteLine("Enter any 2nd number :")
num = Console.ReadLine()
End Sub
Public Sub put2()
Console.WriteLine("your 2nd number is :" +
num.ToString)
End Sub
End Class
Sub Main(args As String())
Dim obj1 = New class2()
obj1.get1()
obj1.put1()
obj1.get2()
obj1.put2()
End Sub
End Module
21. Implement a program for Overloading.
Imports System
Module Program
Class class1
Dim a, b As Integer
Sub Add(x As Integer)
a = x
b = x
Console.WriteLine("Addition=" & (a + b))
End Sub
Sub Add(x As Integer, y As Integer)
a = x
b = y
Console.WriteLine("Addition=" & (a + b))
End Sub
End Class
Sub Main(args As String())
Dim obj1 = New class1()
obj1.Add(10)
obj1.Add(20, 30)
Console.ReadLine()
End Sub
End Module
22. Implement a program for Overriding.
Imports System
Module Program
Class class1
Dim a, b As Integer
Overridable Sub Add(x As Integer, y As Integer)
a = x
b = y
Console.WriteLine("Addition=" & (a + b))
End Sub
End Class
Class class2 : Inherits class1
Dim a, b As Integer
Overrides Sub Add(x As Integer, y As Integer)
a = x
b = y
Console.WriteLine("Addition=" & (a + b))
End Sub
End Class
Sub Main(args As String())
Dim obj1 = New class2()
obj1.Add(10, 20)
obj1.Add(30, 40)
End Sub
End Module
23. Implement a program to demonstrate Shadowing in
Inheritance.
Imports System
Module Program
Class class1
Dim a, b As Integer
Sub Add(x As Integer, y As Integer)
a = x
b = y
Console.WriteLine("Addition=" & (a + b))
End Sub
End Class
Class class2 : Inherits class1
Dim a, b As Integer
Shadows Sub Add(x As Integer, y As Integer)
a = x
b = y
Console.WriteLine("Addition=" & (a + b))
End Sub
End Class
Sub Main(args As String())
Dim obj1 = New class2()
obj1.Add(10, 20)
obj1.Add(30, 40)
End Sub
End Module
24. Implement a program to handle runtime errors using
Exception Handling.
Imports System
Module Program
Sub Main(args As String())
Dim a, b, c As Integer
Try
a = 8
b = 0
c = a \ b
Catch ex As DivideByZeroException
Console.WriteLine("DivideByZeroException has")
Console.WriteLine("result : {0}", c)
End Try
End Sub
End Module