FINAL
FINAL
NET TERMINOLOGY
1. What is .NET?
.NET stands for Network Enabled Technology.
.NET is not programming language. It is a framework which provides
platform in which .NET application is executed.
It is a product of Microsoft that was developed in 2000.
It is used in the development of various kinds of application like
desktop based, web based, mobile based application etc.
Code & text editor window-This window allows you to enter &
edit code & text.This window is called Code editor or text editor
windows based on purpose for which use it.Used this for to add code
for form.
17. What is assembly?
Assemblies are the building blocks of .NET Framework applications. It
contains the code that the runtime executes.
An assembly almost always consists of at least two files: the executable
and the manifest.
The manifest is a list of all the files that exist inside the assembly. The
executable content inside the assembly is referred to individually as a
module. An assembly is a collection of one or more .exe or dll. An
assembly is the fundamental unit for application development and
deployment in the .NET framework.
There are two types of assembly private and public assembly. A private
assembly is used by a single application and is stored in the application`s
directory. A shared assembly is normally stored in the global assembly.
Assembly consist of the following contents.
Simple if statement
Syntax:-
If condition then
Block of statements
End if
Example
Dim n as integer=10
If n mod 2=0 then
Console.writLine(“Even “)
End if
If n mod 2=1 then
Console.writLine(“odd “)
End if
If - else statement
Syntax:-
If condition then
Block of statements
Else
Block of statements
End if
Example
Dim n as integer=10
If n mod 2=0 then
Console.writLine(“Even “)
else
Console.writLine(“odd “)
End if
If else if statement
Syntax:-
If condition1 then
Block of statements
Elseif condition2 then
Block of statements
Elseif condition3 then
Block of statements
..............................
...............................
..................................
Elseif condition n then
Block of statements
Else
Block of statements
End if
Example
End If
WriteLine("Greatest number=" & gt)
Nested if statement
Syntax:-
If condition then
If condition then
Block of statements
Else
Block of statements
End if
Else
If condition then
Block of statements
Else
Block of statements
End if
End if
Example
Dim a%
WriteLine("Enter any number")
a = CInt(readLine())
If a Mod 2 = 0 Then
If a > 0 Then
WriteLine("Even +ve")
Else
WriteLine("Even -ve")
End If
Else
If a > 0 Then
WriteLine("odd +ve")
Else
WriteLine("odd -ve")
End If
End If
Example:-
Dim ch As Char
WriteLine("Enter any alphabet")
ch = ChrW(Read())
Select Case ch
Case "a", "A", "e", "E", "i", "I", "o", "O",
"u", "U"
'WriteLine("vowel")
MessageBox.Show("vowel")
Case Else
' WriteLine("Consonent")
MessageBox.Show("consonent")
End Select
Case else
Block of statements
End select
Example:-
Dim roll As Integer, nm As String, cs As String, c, cpp,
java, vb, tm As Integer, pm As Single, remark As String
WriteLine("Enter rollno, name,course and marks of
four subject")
roll = CInt(ReadLine())
nm = ReadLine()
cs = ReadLine()
c = CInt(ReadLine())
cpp = CInt(ReadLine())
java = CInt(ReadLine())
vb = CInt(ReadLine())
tm = c + cpp + java + vb
pm = tm / 4
Select Case pm
Case 90 To 100
remark = "Excellent"
Case 75 To 89
remark = "very good"
Case 60 To 74
remark = "good"
Case 45 To 59
remark = "poor"
Case Else
remark = "Fail"
End Select
Case else
Block of statements
End select
Example:-
Dim roll As Integer, nm As String, cs As String, c, cpp,
java, vb, tm As Integer, pm As Single, remark As String
WriteLine("Enter rollno, name,course and marks of
four subject")
roll = CInt(ReadLine())
nm = ReadLine()
cs = ReadLine()
c = CInt(ReadLine())
cpp = CInt(ReadLine())
java = CInt(ReadLine())
vb = CInt(ReadLine())
tm = c + cpp + java + vb
pm = tm / 4
Select Case pm
Case Is >= 90
remark = "Excellent"
Case Is >= 75
remark = "very good"
Case Is >= 60
remark = "good"
Case Is >= 45
remark = "poor"
Case Else
remark = "Fail"
End Select
Looping statement
Syntax:
For index=start_value TO end_value [STEP value]
Block of statements
Next
Note:- Step keyword is used to increase or decrease value of variable. For
loop increases value of variable by one automatically.
Example:-
For i = 1 To 50 Step 2
Console.WriteLine(i)
Next
2. While loop:-
Syntax:-
While condition
Block of statements
End while
Example
i = 1
While i <= 100
Console.WriteLine(i)
i = i + 1
End While
Syntax:-
do
Block of statements
loop while condition
Example
i = 1
Do
Console.WriteLine(i)
i = i + 1
Loop While i <= 100
B. do------loop until
Syntax:-
do
Block of statements
loop until condition
Example
i = 1
Do
Console.WriteLine(i)
i = i + 1
Loop Until i > 100
C. do while----------loop
Syntax:-
Do while condition
Block of statements
Loop
Example
i = 1
Do While i <= 100
Console.WriteLine(i)
i = i + 1
Loop
D. do until ---------------loop
Syntax:-
Do until condition
Block of statements
Loop
Example
i = 1
Do until i > 100
Console.WriteLine(i)
i = i + 1
Loop
Example
Dim a() As Integer = {4, 5, 6, 7, 8, 9}
For Each i In a
Console.WriteLine(i)
Next
Jumping statement
a. Exit for
b. Exit while
c. Exit do
d. Exit
e. Exit function
f. Exit sub
Array:-
It is a special variable which is used to hold multiple values.
Types of array
1. One dimensional array
2. Two dimensional array
3. Three dimensional array
4. Jagged array
i.e
10 20 30 40 50 60 70 80 90 100
0 1 2 3 4 5 6 7 8 9
Declaration:-
Syntax:-
Example
Program-1
Imports System.Console
Module Module2
Sub main()
Dim a(10) As Integer, svalue As Integer, i%, flag%
flag = 0
'WriteLine("length of array=" & a.Length)
'Dim a() As Integer = New Integer(10) {}
'Dim a() As Integer = {10, 20, 30, 40,
50}'Initialization
' Dim a() As Integer = New Integer() {10, 20, 30,
40, 50}
' Dim a() As Integer = New Integer(4) {10, 20, 30,
40, 50}
WriteLine("Enter 10 numbers")
For i = 1 To a.Length - 1
a(i) = CInt(ReadLine())
Next
WriteLine("Enter any searching element")
svalue = CInt(ReadLine())
For i = 1 To a.Length - 1
If a(i) = svalue Then
flag = 1
Exit For
End If
Next
If flag = 1 Then
WriteLine("Searching found")
Else
WriteLine("Searching not found")
End If
ReadKey()
End Sub
Program-2
Sub Main()
Dim a() As Integer = New Integer(10) {}
Dim i%, j%, temp%
WriteLine("enter 10 numbers")
For i = 1 To a.Length - 1
a(i) = CInt(ReadLine())
Next
For i = 1 To a.Length - 1
For j = i + 1 To a.Length - 1
If a(i) > a(j) Then
temp = a(i)
a(i) = a(j)
a(j) = temp
End If
Next
Next
WriteLine("All elements in ascending order")
For i = 1 To a.Length - 1
WriteLine(a(i))
Next
ReadKey()
End Sub
End Module
Two dimensional array:- It represents value in matrix format such as row and
column.
Example:-
10 20 30 ROW-1
40 50 60 ROW-2
70 80 90 ROW-3
100 110 120 ROW-4
COL-1 COL-2 COL-3
Key points
'Intialization
Dim g(,) As Integer = New Integer(,) {{1, 2, 3}, {6,
8, 9}} 'Intialization
Dim h(,) As Integer = New Integer(1, 2) {{1, 2, 3},
{6, 8, 9}}
Dim i(,) As Integer = New Integer(3, 2) {}
'Declaration
Program:-
Sub Main()
' Dim a(3, 2) As Integer, i%, j%
Dim a(,) As Integer = New Integer(3, 2) {}
'Dim a(,) As Integer = {{1, 2}, {4, 5}, {6, 7}}
'Dim a(,) As Integer = New Integer(,) {{1, 2}, {4,
5}, {6, 7}}
' Dim a(,) As Integer = New Integer(2, 1) {{1, 2},
{4, 5}, {6, 7}}
WriteLine("Enter value of matrix")
For i = 1 To 3
For j = 1 To 2
a(i, j) = CInt(ReadLine())
Next
Next
WriteLine("Matrix is")
For i = 1 To 3
For j = 1 To 2
Write(a(i, j) & vbTab)
Next
WriteLine()
Next
ReadKey()
End Sub
End Module
Example:-
Key points
Program:-
'wap in vb.net to input any four matrix after that print all
it
Imports System.Console 'including namespace
Module Module1
Sub Main()
Dim a(4, 3, 2) As Integer, i%, j%, k%
For k = 1 To 2
a(i, j, k) = CInt(ReadLine())
Next
Next
Next
For k = 1 To 2
Write(a(i, j, k) & vbTab)
Next
WriteLine()
Next
Next
ReadKey()
End Sub
End Module
Jagged/Ragges array:- It is a type of two dimensional array. In this array each row
can have multiple columns a/c to requirement.
Example:-
4
5 8 9
6
7 8 10 11 23
1 2
Key points
Next
For s = 0 To q.Length - 1
For t = 0 To q(s).Length - 1
Write(q(s)(t) & vbTab)
Next
WriteLine()
Next
Dynamic array:-
In this array we can change/modify the size of array during runtime. Size of array
is increased and decreased with the help of redim keyword a/c to requirement.
Declaration:-
Syntax:-
Example
Dim rollno()as integer
Redim rollno(5)
Program:-
Sub Main()
For i = 0 To 10
Console.WriteLine(i & vbTab & marks(i))
Next
ReadKey()
End Sub
End Module
Procedure(Function & subroutine)
Procedure:- It is a block of well- defined statements which is
used to design for performing any special task a/c to
requirement.
Types of procedure
1. Subroutine
2. Function
Syntax:-
Sub <subroutine name>([parameter list])
Block of statements
End sub
Example:-
Sub findadd()
Dim a as integer,b as integer,sum as integer
a=20
b=30
sum=a+b
writeline(“Addition=”& sum)
End sub
How to call subroutine?
Call:- This keyword is used to call subroutine
Syntax:- call <subroutine name>()
Example:-
Sub main()
Call findadd()
End sub
Function:-
Syntax:-
function <function name>([parameter list])as<return type>
Block of statements
End function
Example:-
function findadd() as integer
Dim a as integer,b as integer,sum as integer
a=20
b=30
sum=a+b
return sum
End function
How to call function?
2nd method
Sub main()
writeline(“Addition=” & findadd())
End sub
Program:
' To input employee id, name,post and salary of
employee after that print it.
Imports System.Console
Module employee
Dim empid$, ename$, post$, salary% 'global
variable
Sub getInput()
WriteLine("Enter employee id, name, post and
salary")
empid = ReadLine()
ename = ReadLine()
post = ReadLine()
salary = CInt(ReadLine())
End Sub
Sub showRecord()
WriteLine("Employee id=" & empid & vbNewLine
& "Name=" & ename & vbNewLine & "Post=" & post &
vbNewLine & "Salary=" & salary)
End Sub
Sub main()
Call getInput() ' calling subroutine
Call showRecord()
ReadKey()
End Sub
End Module
Program
End Sub
Sub showRecord()
WriteLine("Employee id=" & empid & vbNewLine
& "Name=" & ename & vbNewLine & "Post=" & post &
vbNewLine & "Salary=" & salary)
End Sub
Sub main()
Call getInput("E-101", "Shubham", "Manager",
50000) ' calling subroutine
Call showRecord()
ReadKey()
End Sub
End Module
Imports System.Console
Module swapping
Sub swapping(ByVal a As Integer, ByVal b As
Integer)
Dim tmp As Integer
tmp = a
a = b
b = tmp
WriteLine("After swapping value of a=" & a &
vbNewLine & "value of b=" & b)
End Sub
Sub main()
Dim a As Integer, b As Integer 'actual
parameter
WriteLine("Enter two numbers")
a = CInt(ReadLine())
b = CInt(ReadLine())
WriteLine("Before calling swapping function
value of actual parameter" & vbNewLine & "a=" & a &
vbNewLine & " b=" & b)
Call swapping(a, b) ' calling subroutine
WriteLine("after calling swapping function
value of actual parameter" & vbNewLine & "a=" & a &
vbNewLine & " b=" & b)
ReadKey()
End Sub
End Module
Types of constructor
There are the following types of constructor.
Default constructor
Parameterized constructor
Copy constructor
Shared constructor
Default constructor:-
Example
Sub New()
Writeline(“Default constructor”)
End sub
Parameterized constructor:-
This type of constructor contains parameter list.
Syntax:-
Sub New(parameter list)
Block of statements
End sub
Example
Sub New(a as integer, b as integer)
Writeline(“Parameterized constructor”)
End sub
Parameterized constructor:-
This type of constructor contains parameter list.
Syntax:-
Sub New(parameter list)
Block of statements
End sub
Example
Sub New(a as integer, b as integer)
Writeline(“Parameterized constructor”)
End sub
copy constructor:-
This type of constructor is used to copy value of one object
into another object. It can have one parameter as object of
class.
Syntax:-
Sub New(object of class)
Block of statements
End sub
Example
Sub New(emp as Employee)
Writeline(“Copy constructor”)
End sub
Program
End Sub
Public Sub New(emp As Employee) 'Copy constructor
empid = emp.empid
ename = emp.ename
post = emp.post
salary = emp.salary
End Sub
Public Sub showRecord()
WriteLine("Employee id=" & empid & vbNewLine &
"Name=" & ename & vbNewLine & "Post=" & post & vbNewLine &
"salary=" & salary)
End Sub
End Class
Sub main()
Dim e1 As New Employee() 'executes default
constructor
Dim e2 As New Employee("E-101", "Ritesh", "Manager",
50000) 'executes parameterizied constructor
Dim e3 As New Employee(e1) 'executes copy
constructor
Dim e4 As New Employee(e2)
e1.showRecord()
e2.showRecord()
e3.showRecord() 'print record of obect e1
e4.showRecord() 'print record of object e2
e4 = e1
e4.showRecord()
ReadKey()
End Sub
End Module
Shared keyword
Program:-
Module shared_constructor
Class Shared_constructorEx
Dim rollno, name, course As String
Shared college_name As String
Public Sub New() 'instance constructor
WriteLine("Enter rollno,name and course")
rollno = ReadLine()
name = ReadLine()
course = ReadLine()
End Sub
Shared Sub New() 'shared constructor
college_name = "CIMAGE"
WriteLine("Welcome to shared
constructor")
End Sub
Public Sub showRecord()
WriteLine("Rollno=" & rollno & vbNewLine
& "Name=" & name & vbNewLine & "course=" & course &
vbNewLine & "College name=" & college_name)
End Sub
End Class
Sub main()
Dim obj As New Shared_constructorEx()
obj.showRecord()
ReadKey()
End Sub
End Module
Creating class in VB.net
Class:-class keyword is used to create class.We know that
class is a container in which member variable and
member function are composed in single unit. It provides
user-defined data type.
Members of class
1. Member variable/instance variable
2. Member function
Class Student
Dim rollno As Integer ' default access
specifier is private
Public name As String
Private course As String
Protected fee As Single
Public Sub getInput()
WriteLine("Enter rollno,name,course and
fee")
rollno = CInt(ReadLine())
name = ReadLine()
course = ReadLine()
fee = CSng(ReadLine())
End Sub
Sub showResult()
WriteLine("Rollno=" & rollno & vbNewLine
& "Name=" & name & vbNewLine & "Course=" & course &
vbNewLine & "Fee=" & fee)
End Sub
End Class
Creating an object
Object is used to access the member of class. We can
create multiple objects of class so class is said to be
collection of objects.
Syntax:-
1st method
Dim <object name> as new <class name>()
Example
Dim obj as new student()
2nd method
Syntax:-
Dim <object name> as <class name>=new <class name>()
Example
Dim obj as student=new student()
Program
Imports System.Console
Module student
Class Student
Dim rollno As Integer ' default access
specifier is private
Public name As String
Private course As String
Protected fee As Single
Public Sub getInput()
WriteLine("Enter rollno,name,course and
fee")
rollno = CInt(ReadLine())
name = ReadLine()
course = ReadLine()
fee = CSng(ReadLine())
End Sub
Sub showResult()
WriteLine("Rollno=" & rollno & vbNewLine
& "Name=" & name & vbNewLine & "Course=" & course &
vbNewLine & "Fee=" & fee)
End Sub
End Class
Sub main()
Dim obj As Student = New Student() 'creating
object
'creating more than one object
' Dim obj1 As Student = New Student()'both
declaration and allocation
'Dim obj2 As Student = New Student()
'Dim obj3 As Student = New Student()
Dim obj1, obj2, obj3 As Student 'declaration
of multiple object
obj1 = New Student() 'allocation of object
obj2 = New Student()
obj3 = New Student()
obj.getInput() 'calling member function
obj.showResult()
WriteLine("Course=" & obj.name)
ReadKey()
End Sub
End Module
End Sub
Overloads Sub findArea(ByVal side As Integer)
WriteLine("Area of square=" & side *
side)
End Sub
Overloads Function findPeri(ByVal l As
Integer, b As Integer) As Integer
Return 2 * (l + b)
End Function
Overloads Function findPeri(ByVal side As
Integer) As Integer
Return 4 * side
End Function
End Class
Sub main()
Dim obj1, obj2 As New shape()
obj1.findArea(10, 20)
obj1.findArea(10)
WriteLine("Perimeter of rectangle=" &
obj1.findPeri(10, 30))
WriteLine("Perimeter of square=" &
obj1.findPeri(10))
'obj2 = obj1
WriteLine("Perimeter of square=" &
obj2.findPeri(10))
ReadKey()
End Sub
End Module
Inheritance
Inheritance:-
It is the most important tool of object oriented
programming.
It provides a technique in which one class is
inherited from other class. In other words the
process of creating sub class from super class is
called inheritance.
It provides reusability. It means once written
source code can be reused multiple times a/c to
requirement.
Types of inheritance
1.Single level
2.Multi level
3.Multiple inheritance
4.Hierarchical
5.Hybrid
Member of class
End class
Example:-
Class xyz
Member of class
End class
Class abc
Inherits xyz
Member of class
End class
Function overriding:-
Program-1
Imports System.Console
Module single_level
Class Rectangle 'super class
Protected l, b, area, peri As Integer
Overridable Sub getInput() 'subroutine
overriding/function overriding
WriteLine("Enter length and breadth") : l
= CInt(ReadLine()) : b = CInt(ReadLine())
End Sub
Overridable Function findArea() As Integer
area = l * b
Return area
End Function
Sub findPeri()
peri = 2 * (l + b)
End Sub
End Class
' Class square
'Inherits Rectangle
Class square : Inherits Rectangle 'creating sub
class
Dim s As Integer
Shadows area, peri As Integer
Overrides Sub getInput()
MyBase.getInput()
End Class
Sub main()
Dim obj As New square
obj.getInput()
obj.findArea()
obj.findPeri()
obj.calculatePeri()
obj.getResult()
ReadKey()
End Sub
End Module
Constructor in inheritance:-
We know that constructor of super class can not be inherited into sub
class. But when we create an object of sub class then first default
constructor of super class will be executed after that default
constructor of sub class executes. In this case of ”mybase.new()” works
by default. It is optional.
Syntax:-
Mybase.new([parameter list])
Program-2
End Sub
Sub New(bank_id As String, bank_name As
String, branch_name As String)
Me.bank_id = bank_id
Me.bank_name = bank_name
Me.branch_name = branch_name
End Sub
End Class
Class customer : Inherits Bank
Dim cid, cname As String, balance As Integer
Sub New()
' MyBase.New() 'optional
WriteLine("Enter customer id, customer
name and balance")
cid = ReadLine()
cname = ReadLine()
balance = CInt(ReadLine())
End Sub
Sub New(bank_id As String, bank_name As
String, branch_name As String, cid As String, cname
As String, balance As Integer)
MyBase.New(bank_id, bank_name,
branch_name) 'calling parameterized constructor of
base class in constructor of sub class
Me.cid = cid
Me.cname = cname
Me.balance = balance
End Sub
Sub showResult()
WriteLine("Customer id=" & cid &
vbNewLine & "customer name=" & cname & vbNewLine &
"balance=" & balance & vbNewLine & "Bank id=" &
bank_id & vbNewLine & "Bank name=" & bank_name &
vbNewLine & "Branch name=" & branch_name)
End Sub
End Class
Sub main()
Dim obj1 As New customer() 'calling default
constructor of both class
Dim obj2 As New customer("P-102", "PNB",
"Gandhi Maidan", "C-1001", "Avinash", 400000)
obj1.showResult()
obj2.showResult()
ReadKey()
End Sub
End Module
Multi level inheritance:-
An extending single level inheritance is called multi level
inheritance.
Program-3
End Sub
Public Overrides Sub showResult()
MyBase.showResult()
WriteLine("Employee id=" & eid &
vbNewLine & "name=" & ename & vbNewLine & "post=" &
post)
End Sub
End Class
Class Employee_Salary_slip : Inherits Employee
Dim bs, gs, ns, hra, da, ta, ma, pf As Single
Public Sub New()
WriteLine("Enter basic salary of
employee")
bs = CDbl(ReadLine())
End Sub
Public Sub findAllowance()
If bs >= 20000 Then
hra = bs * 40 / 100
da = bs * 90 / 100
ta = bs * 30 / 100
ma = bs * 10 / 100
pf = bs * 10 / 100
ElseIf bs >= 10000 Then
hra = bs * 30 / 100
da = bs * 80 / 100
ta = bs * 20 / 100
ma = bs * 8 / 100
pf = bs * 10 / 100
Else
hra = bs * 20 / 100
da = bs * 70 / 100
ta = bs * 15 / 100
ma = bs * 5 / 100
pf = bs * 10 / 100
End If
gs = bs + hra + da + ta + ma + pf
ns = gs - pf
End Sub
Public Sub printMarksheet()
showResult()
WriteLine("Salary details" & vbNewLine &
"-------------------------------" & vbNewLine &
"Basic salary=" & bs & vbNewLine & "HRA=" & hra &
vbNewLine & "DA=" & da & vbNewLine & "TA=" & ta &
vbNewLine & "MA=" & ma & vbNewLine & "PF=" & pf &
vbNewLine & "Gross salary=" & gs & vbNewLine & "Net
Salary=" & ns)
End Sub
End Class
Sub main()
Dim obj As New Employee_Salary_slip()
obj.findAllowance()
obj.printMarksheet()
ReadKey()
End Sub
End Module
Abstract class:-
Program-4
Module Abstract_class
MustInherit Class Shape 'abstract class
Protected area As Single
Protected peri As Single
Dim sname As String
Public Sub New()
WriteLine("Enter shape name")
sname = ReadLine()
End Sub
Public Sub showShapeName()
WriteLine("shape name=" & sname)
End Sub
Public MustOverride Sub findArea() 'abstract
subroutine
Public MustOverride Sub findPeri()
End Class
Class Rectangle : Inherits Shape
Dim l, b As Integer
Public Sub New()
WriteLine("Enter length and breadth")
l = CInt(ReadLine())
b = CInt(ReadLine())
End Sub
Public Overrides Sub findArea() 'overriding
area = l * b
WriteLine("Area of rectangle=" & area)
End Sub
End Sub
End Module
Interface:-
Creating an interface
Syntax:-
Interface <interface name>
Function declaration
End interface
Implementing an interface:-
Implements:- This keyword is used to implement an interface.
Syntax:-
Class <class name>
Implements <interface name>
Program-5
Sub findArea()
Sub findPeri()
End Interface
Class Square
Implements shape
Dim s, ar, pr As Integer
Sub New()
WriteLine("Enter side of square")
s = CInt(ReadLine())
End Sub
Public Sub findArea() Implements
shape.findArea
ar = s * s
WriteLine("Area of square=" & ar)
End Sub
End Class
Class Circle
Implements shape
Dim r, ar, pr As Single
Const pi As Single = 3.14
Sub New()
WriteLine("Enter radius of circle")
r = CDbl(ReadLine())
End Sub
Public Sub findArea() Implements
shape.findArea
ar = pi * r * r
WriteLine("Area of Circle=" & ar)
End Sub
Public Sub findPeri() Implements
shape.findPeri
pr = 2 * pi * r
WriteLine("Perimeter of Circle=" & pr)
End Sub
End Class
Sub main()
Dim sq As New Square()
Dim ci As New Circle()
sq.findArea()
sq.findPeri()
ci.findArea()
ci.findPeri()
ReadKey()
End Sub
End Module
Multiple inheritance:-
When one sub class inherited from more than one super class is
called multiple inheritance. This type of inheritance contains one
sub class and more super classes.
VB.net does not support multiple inheritance directly like java. It
can be implemented with the help of interface.
Program-6
End Sub
End Sub
Sub showCurrentStatus()
WriteLine("Current status of account" &
vbNewLine & "Customer id=" & cid & vbTab & "customer
name=" & cnm)
WriteLine("Current balance=" & balance)
End Sub
End Class
Sub main()
Dim obj As New Transaction
obj.debit()
obj.credit()
obj.debit()
obj.debit()
obj.showCurrentStatus()
ReadKey()
End Sub
End Module
NAMESPACE
Assembly
WINDOW PROGRAMMING
ADO.NET
GUI BASED PROGRAM IN VB.NET
1. LOGIN PROGRAM
2.
Else
MessageBox.Show("Login Failed")
End If
End Sub
3. ARITHMETIC OPERATION
End Sub
Private Sub btnsub_Click(sender As System.Object, e As System.EventArgs) Handles
btnsub.Click
a = CInt(txtfirst.Text)
b = CInt(txtsecond.Text)
rs = a - b
txtresult.Text = rs
lblresult.Text = "Subtraction=" & rs
End Sub
End Sub
End If
If chknews.Checked = True Then
hob = hob & chknews.Text & " "
End If
End If
rs = "Name=" & nm & vbNewLine & "Father's name=" & fnm & vbNewLine & "Course=" &
cs & vbNewLine & "Gender=" & gen & vbNewLine & "Nationality=" & nation & vbNewLine &
"Hobbies=" & hob & vbNewLine & "Email id=" & email
MessageBox.Show(rs)
End Sub
else
cmbcolor.Items.Add(txtcolor.Text)
txtcolor.Text = ""
txtcolor.Focus()
End If
End Sub
End Sub
End Sub
End Class
6. MOVING & COPING PLAYER FROM ONE LIST TO ANOTHER LISTBOX
End Sub
End Sub
End If
Next
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Private Sub btncopy1_Click(sender As Object, e As EventArgs) Handles btncopy1.Click
Dim i As Integer
For i = 0 To lstoneday.Items.Count - 1
If lstoneday.GetSelected(i) Then
If lsttest.Items.Contains(lstoneday.Items(i)) Then
MsgBox(lstoneday.Items(i) & " Already available")
Else
lsttest.Items.Add(lstoneday.Items(i))
End If
End If
Next
End Sub
7. DIALOG BOX
End Sub
End Class
8. MENUSTRIP
Public Class menu
Dim a, b, rs As Integer
Private Sub RedToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles
RedToolStripMenuItem.Click
lblmsg.BackColor = Color.Red
End Sub
End Sub