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

WINDOWS APPLICATION

1
ARITHMETIC OPERATION

AIM:
To write a VB.Net program to perform Arithmetic operation using Windows Application.

Source code
Public class Arithmetic operation

Private Sub Add_click(sender As Object, e As Event Args) Handles Add.Click

Text Box3.Text = val(Textbox1.Text) + val(Textbox2.text)

End sub

Private Sub Subtraction_click(sender As Object, e As Event Args) Handles subtraction.Click

Text Box3.Text = val(Textbox1.Text) - val(Textbox2.text)

End sub

Private Sub Multiplication_click(sender As Object, e As Event Args) Handles


Multiplication.Click

Text Box3.Text = val(Textbox1.Text) * val(Textbox2.text)

End sub

Private Sub Divison_click(sender As Object, e As Event Args) Handles Div.Click

Text Box3.Text = val(Textbox1.Text) / val(Textbox2.text)

End sub

Private Sub clear_click(sender As Object, e As Event Args) Handles clear.Click

2
Textbox1.Text=” “

Textbox2.Text=” “

Textbox3.Text=” “

End sub

End class

Result:

Thus the above Program was Created And verified Sucessfully.

3
INPUT FORM DESIGN

OUTPUT FORM DESIGN

4
FACTORIAL NUMBER

Aim:
To Write a Vb.net Program to perform Factorial Number using Windows application

Source code:
Public Class form 1

Dim n,i ,fact as Integer

Private Sub Button 1 _ click (sender As Object, e As Event Args)Handles Button.click

fact = 1

n = val (Textbox 1. Text)

for I = 1 to n

fact =fact * i

next i

Msg Box(fact)

End sub

Private Sub Button 2 _ click (sender As Object, e As Event Args)Handles Button2.click

Text Box 1.Text =” “

End Sub

Private Sub Button 3 _ click (sender As Object, e As Event Args)Handles Button3.click

End

5
End sub

End class

Result:

Thus the above Program was Created And verified Sucessfully.

6
INPUT FORM DESIGN

OUTPUT FORM DESIGN

7
PRIME NUMBER
Aim:

To Write a Vb.net Program to perform Prime Number using Windows


application

Source code:
Public class Form 1

Dim n,j,i As Integer

Private Sub Button1_ click (Sender As object. e As Event args )Handles Button1.click

n = val (TextBox1.Text)

j= 1

for i=2 To n-1

if n mod 1=0 then

j=0

end if

next i

if j= 1 then

msg Box (“The Number is Prime”)

else

msg Box (“The Number is not Prime”)

end if

End sub

Private Sub Button2_ click (Sender As object. e As Event args )Handles Button2.click

TextBox1.Text=” “

8
End Sub

Private Sub Button3_ click (Sender As object. e As Event args )Handles Button3.click

End

End Sub

End Class

Result:

Thus the above Program was Created And verified Sucessfully

9
INPUT FORM DESIGN

OUTPUT FORM DESIGN

10
ODD OR EVEN

Aim:
To Write a VB.Net program to seperation Odd or Even using windows
application.

Source code:

Public Class form1


Dim n As Integer
Private Sub Button1_Click(Sender As Object, e As Event Args)Handles
Button1.click
n = Val(TextBox1.Text)
if = (n mod 2 = 0)then
ListBox1.items.Add(n)
Msg box("The Number is Odd")
End if
End Sub
Private Sub Button2_Click(Sender As Object, e As Event Args)Handles
Button2.click
End
End Sub
Private Sub ListBox1.Select Index Changed(Sender As Object, e As Event
Args)Handles ListBox1.Select Index Changed
End Sub
End Class

Result:

Thus, the above VB.Net program was executed and verified


Successfully.

11
INPUT FORM DESIGN

OUTPUT FORM DESIGN

12
BIGGEST TWO NUMBERS

Aim:
To Create a VB.Net program to perform Biggest Two Numbers using
windows Application.

Source code:

Public Class form1


Dim a, b, As Integer
Private Sub Button1_Click(Sender As Object, e As Event Args)Handles
Button1.Click
a = Val(TextBox1.Text)
b = Val(TextBox2.Text)
if(a > b)Then
MsgBox("The Number A is big")
Else
MsgBox ("The Number B is big")
End if
End Sub
Private Sub Button2_Click(Sender As Object, e As Event Args)Handles
Button2.Click
TextBox1.Text = " "
TextBox2.Text = " "
End Sub
Private Sub Button3_Click(Sender As Object, e As Event Args)Handles
Button3.Click
End
End Sub
End Class

13
INPUT FORM DESIGN

OUTPUT FORM DESIGN

Result:
Thus, the above program was executed and verified Successfully.

14
MS ACESSS

15
STUDENT DETAIL USING DATABASE

Aim:
To Write a ASP.Net program to create Student Detailed Database using
ASP.Net with MS Access.

Source code:
Imports System.Data.OleDb
Partial Class Student details Inherits System.Web.UI.Page
Dim Cn as OleDb Connection
Dim Cmd as OleDb Command
Dim Con as String = "Provider = Microsoft.jet.OleDb.4:0; Data Source =
D:\Hari\stu.mdb"
Dim q as String
Dim a as Integer
Dim dr as OleDb Data reader
Protected Sub Button1_Click(Sender As Object, e As Event Args)Handles
Button1.Click
Cn = New OleDb Connection(Con)
Cn.open()
q = "insert into S1 Values(' "+TextBox1.Text+" ', ' "+TextBox2.Text+" ', '
"+TextBox3.Text+" ', ' "+TextBox4.Text+" ')"
Cmd = New OleDb Command(q, Cn)
Cmd.Executed Non Query()
Cn.Close()
MsgBox("record inserted")
End Sub
Protected Sub Button2_Click(Sender As Object, e As Event Args)Handles
Button2.Click
Cn = New. OleDb Connection(Con)
Cn.Open()
q = "Select * from S1 where S.No=' "+TextBox1.Text+" '
Cmd = New OleDb Command(q, Cn)
16
dr = Cmd.Execute Reader()

while dr.Read()
a=1
TextBox1.Text = dr(0)
TextBox2.Text = dr(1)
TextBox3.Text = dr(2)
TextBox4.Text = dr(3)
End while
Cn.Close()
if a = 1 Then
MsgBox("record found")
Else
MsgBox("record not found")
End if
End Sub
Protected Sub Button5_Click(Sender As Object, e As Event Args)Handles
Button5.Click
TextBox1.Text = " "
TextBox2.Text = " "
TextBox3.Text = " "
TextBox4.Text = " "
End Sub
Protected Sub Button4_Click(Sender As Object, e As Event Args)Handles
Button4.Click
Cn = New OleDb Connection(Con)
Cn.Open()
q = "delete * from S1 where S.No="+TextBox1.Text+""
Cmd = New OleDb Command(q, Cn)
Cmd.Execute Non Query()
Cn.Close()
MsgBox("Record deleted")
End Sub
Protected Sub Button4_Click(Sender As Object, e As Event Args)Handles
Button4.Click
17
Cn = New OleDb Connection(Con)
Cn.Open()
q = "update S1 Set S.No=' "+TextBox1.Text+" ' SName='
"+TextBox2.Text+" ', DEPT=' "+TextBox3.Text+" ', Class=' "+TextBox4.Text+" '
where S.No="+TextBox1.Text+""

Cmd = New OleDb Command(q, Cn)


Cmd.Executed Non Query()
Cn.Close()
MsgBox("Record update")
End Sub
End Class

Result:
Thus, the above program was executed and verified
Successfully.

18
INPUT FORM DESIGN

OUTPUT FORM DESIGN

19
EMPLOYEE DETAIL USING DATABASE

Aim:
To Write a ASP.Net program to create Employee Detailed Database using
ASP.Net with MS Access.

Source code:
imports system.data dedb
partial class employee details

Inherit system web.UI page


dim cr as dedb correction
dim cmd as dedb command
dim con as string="provider=microsoft.jet.oledb 4.0;data
source=E:\hari\emp.mbd"
dim q as integer
dim dr as dedbdatareader
protected sub button click (sender as object,e as eventargs)handles
button1.click
cr= new dedb correction(con)
cr.open()
q="insert into E1
values("+textboxing+textbox2.text+";"+textbox3.text+";+textbox4.text+")
cmd=new dedb command(q.cr)
cmd execution query()
cr close()
msg box(record inserted")
end sub
protected sub button2.click(sender as object,e as event args)handles
button2.click
cr=new dedb correction(con)
cr open()
q="select*from e1 where empno="+textbox 1.test""

20
cmd=new dedb command(q.cr)
while dr.read()
a=1
textbox1.text=dr(0)
textbox2.text=dr(1)
textbox3.text=dr(2)
textbox4.text=dr(3)
end while
cr close
if a=1 then
msgbox("record found")
else
msgbox("record not found")
end if
end sub

protected sub button3.click(sender as object,e as event args)handles


button3 click
cr=new dedb correction(con)
cr==open()
q="delete from e1 where empno="+ttextbiox.test"
emd=new dedb command(q,cr)
cmd execute non query()
cr close()
textbox1.text=" "
textbox2.text=" "
textbox3.text=" "
textbox4.text=" "
msg box("record deleted")
end sub

protected sub button4.click (sender as object,e as event args)handles


button4.click
g=new dedb correction(cor)
cr=open()
21
q="update e1 set epno="+textbox1.text+";empno,"+textbox
text1";="+textbox3text+";
salary="+text box4 text+"
where empno="+textbox1.text+"
cmd=new dedb command(q,cr)
cmd.execute non query()
cr.close
msgbox("record updated")
end sub

protected sub button5.click(sender as object, ee as event args)handles


button5.click
textbox1 text=" "
textbox2 text=" "
textbox3 text=" "
textbox4 text=" "
end sub
end class

Result:
Thus, the above program was executed and verified Successfully.

22
INPUT FORM DESIGN

OUTPUT FORM DESIGN

23
CONSOLE APPLICATION

24
ARITHMETIC OPERATION
Aim
To write aVB.Net program to perform Arithmetic operation using console
application.

Source code
Module Module 1
Sub main()
Dim a,b,c As Integer
Console.writeLine(“Arithmetic operation”)
Console.writeLine(“enter the value A”)
a=Integer.Parse(console.ReadLine())
Console.writeline(“enter the value B”)
b=Integer.Parse(console.ReadLine())
c=a+b;
console.writeLine(“Addition of two number is:”&c)
c=a-b;
console.writeLine(“Subtraction of two number is:”&c)
c=a*b;
console.writeLine(“Multiple of two number is:”&c)
c=a/b;
console.writeLine(“Divide of two number is :”&c)
console.Readkey()
Endsub
End Module

25
Result:
Thus, the above program was executed and verified Successfully.

Output:

Arithmetic operation
Enter the value a
6
Enter the value b
2
Addition of two number is : 8
Subtraction of two number is : 4
Multiplication of two number is :18
Divide of two number is : 3

26
Odd or Even
Aim

To write a VB.Net program to perform odd or even using console application

Source code
Module odd or even
Sub main()
Dim a As Integer
Console.writeLine(“odd or even”)
Console.writeLine(“enter the value”)
a=integer.parse(console.ReadLine)
if(a Mod 2=0)then
console.writeLine(“the value is even”)
else
console.writeLine(“the value is odd”)
Endif
Console.Readkey()
Endsub
End Module

Result
Thus above program was executed and verified sucessfully.

27
Output
Odd or even

Enter the value :


4
The value is even.

28
MATHEMATICAL OPERATION
Aim
To write a .Net program to perform Mathematic operation using console
application

Source code
Module Module 1
Sub main()
Dim a,ch As Integer
Dim s As Double
White ()
Console.writeLine(“Mathematical operation”)
Console.writeLine(“1.Root”)
Console.writeLine(“2.Square root”)
Console.writeLine(“3.Absolute”)
Console.writeLine(“4.Round off”)
Console.writeLine(“5.Cose”)
Console.writeLine(“6.Exit”)
Ch=console.Readline()
Select case ch
Case 1
Console.writeLine(“enter the no”)
a=console.ReadLine()
console.write.Line(“Root is {0}”,Math.Pow(a,2))
Case 2
Console.writeLine(“enter the no”)
a=console.ReadLine()
console.write.Line(“Squre root is”,Math.Sqrt(a))
Case 3
Console.writeLine(“enter the no”)
a=console.ReadLine()
console.write.Line(“Absolute is”,Math.Abs(a))
Case 4

29
Console.writeLine(“enter the no”)
s=console.ReadLine()
console.write.Line(“Round off is”,Math.round(s))
Case 5
Console.writeLine(“enter the no”)
a=console.ReadLine()
console.write.Line(“cose is {0}”,Math.cos(a))

Case 6
End
End select
End while
End sub
End Module

Result
Thus the above program has been execite and verified sucessfully.

30
OUTPUT:

31
ARRAY MANIPULATION

Aim
To write a VB.Net program for array manipulation using console application.

Source code
Module Module 1
Sub main()
Dim list As Integer()={34,72,13,44,25,30,10}
Dim temp As Integer()=List
Dim i As Integer
Dim x As Integer
Dim a As Integer
Dim b As Integer
Console.writeLine(“****ARRAY MANIPULATION*****”)
‘LENGTH OF ARRAY’
x=list.Lenght
Console.writeLine(“Maximum Length of list array is{0}”,x)
‘MAXIMUM OF ARRAY’
a=list.max
Console.writeLine(“Maximum Length of list array is{0}”,a)
‘MINIMUM OF ARRAY’
b=list.min
Console.writeLine(“Minimum Length of list array is{0}”,b)
‘ORGINAL ARRAY’
Console.writeLine(“Original array”)
For each i in list
Console.writeLine(“{0}”,i)
Next i
console.writeLine()
‘REVERSE THE ARRAY’
Array.Reverse(temp)

32
console.writeLine(“Reversed array”)
For Each I in temp
console.writeLine(“{0}”,i)
Next
console.writeLine()
‘SORT THE ARRAY’
Array.sort(list)
console.writeLine(“sorted array”)
For Each i in List
console.writeLine(“{0}”,i)
Next i
console.writeLine()
console.ReadKey()
EndSub
End Module

RESULT
Thus the above program has been executed and verified successfully.

33
OUTPUT
****ARRAY MANIPULATION****
Length of list array is :7
Maximum of list array is: 72
Minimum of List array is :0
Original array
34
72
13
44
25
30
10
Reversed array
10
30
25
44
13
72
34
Sorted array
10
13
25
30
34
44
72

34
STUDENT MARK DETAILS USING CLASS

Aim
To write a VB.Net program the student mark details using class

Source code
Module student
Sub Main()
Dim s As new student
s.getdata()
s.putdata()
console.Readkey()
End sub
Public class student
Dim rno,m1,m2,m3,m4,m5,tot,avg As integer
Dim name,course As String
Public Function getdata() As Integer
Console.writeLine(“***Student mark detail***”)
Console.writeLine(“inputdata”)
Console.writeLine()
Console.writeLine(“enter the student regno”)
rno=Integer.parse(Console.ReadLine)
Console.writeLine(“enter the student name”)
Name=console.ReadLine()
Console.writeLine(“enter the student course”)
Course=Console.ReadLine()
Console.writeLine(“enter the student five mark”)
M1=Integer.Parse(console.ReadLine())
M2=Integer.Parse(console.ReadLine())
M3=Integer.Parse(console.ReadLine())
M4=Integer.Parse(console.ReadLine())
M5=Integer.Parse(console.ReadLine())
Tot=m1+m2+m3+m4+m5
Avg=tot/5
35
End function
Publice function putdata() As Integer
Console.write.Line(“output data”)
Console.write.Line(“student regno :{0}”,regno)
Console.write.Line(“student course: {0}”,course)
Console.write.Line(“student mark1:{0}”,m1)
Console.write.Line(“student mark2: {0}”,m2)
Console.write.Line(“student mark3:{0}”,m3)
Console.write.Line(“student mark4: {0}”,m4)
Console.write.Line(“student mark5: {0}”,m5)
End function
End class
End module

RESULT
Thus the above program was execute and verified successfully
36
OUTPUT

***Student Mark detail***


Input data
Enter the student reg no
139
Enter the student name
Taemin
Enter the student course
BSC-IT
Enter the student five mark
98
92
91
88
90
Output data
Student regno 139
Student name Taemin
Student course Bsc-IT
Student mark1 98
Student mark2 92
Student mark3 91
Student mark4 88
Student mark5 90

37
ARITHMETIC OPERATION USING DELEGATE

Aim
To write a VB.Net program to perform Arithmetic operation with delegates by
using console application

Source code
Module arithmetic
Public Delegate sub mydel()
Public Delegate sub mydel 1(By val a As Integer,By var b As Integer)
Public Delegate sub mydel 2(By val a As Integer,By val b As integer)
Public Delegate sub mydel 3(By val a As Integer,By val b As integer)
Public Delegate sub mydel 4(By val a As Integer,By val b As integer)
Public Sub Message()
Console.writeLine(“Arithmetic operation”)
End sub
Public sub add(By val a As Integer ,By val b As Integer)
Dim c As Integer
C=a+b
Console.write(“addition is: ”)
Console.writeLine(c)
End sub
Public sub sub (By val a As Integer ,By val b As Integer)
Dim c As Integer
C=a-b
Console.write(“subtraction is: ”)
Console.writeLine(c)
End sub
Public sub Mul(By val a As Integer ,By val b As Integer)
Dim c As Integer
C=a*b
Console.write(“multiolication is: ”)
Console.writeLine(c)

38
End sub
Public sub Div(By val a As Integer ,By val b As Integer)
Dim c As Integer
C=a/b
Console.write(“division is: ”)
Console.writeLine(c)
End sub()
Sub main()
Dim dlg As mydel
Dlg=new mydel(address of message)
Dlg .invoke()
Dim dlg1 As mydel 1
Dim dlg2 As mydel 2
Dim dlg3 As mydel 3
Dim dlg4 As mydel 4
Dlg 1=new mydel 1(address of add)
Dlg21=new mydel 2(address of sub)
Dlg 3=new mydel 3(address of mul)
Dlg 4=new mydel 4(address of div)
Dlg 1.invoke(25,26)
Dlg2.invoke(25,26)
Dlg 3.invoke(25,26)
Dlg4.invoke(25,26)
Console.ReadLine()
End sub
End Module

RESULT
Thus the above program was executer and verified successfully.

39
OUTPUT
ARITHMETIC OPERATION
Addition is :51
Subtraction is: -1
Multiplication is :65
Division is :1

40
STRING MANIPULATION

AIM
To create a VB.net program the string manipulation using

SOURCE CODE

module module
sub main()
dim s1,s2,s3 as string
dim ch as integer
while()
console.writeline("***string manipulator***")
console.writeline("1.length")
console.writeline("2.upper case to lower case")
console.writeline("3.trim")
console.writeline("4.replace")
console.writeline("5.concatenation")
console.writeline("6.sub string")
console.writeline("7.exit")
ch=console.readline()
select ctc
case 1
console.writeline("enter the string")
s1=console.readline()
console.writeline("the si length is={0}" si.length)

case 2
console.writeline("enter the string si")
s1=console.readline()
console.writeline("lower case to upper case is{0}; si to upper)
console.writeline("enter the string s2")
s2=console.readline()
console.writeline("upper case to lower case is {0};s2 to low)
41
case 3
dim a as string="welcome"
console.writeline("the string pf A is {0}";a)
console.writeline("the trim is {0}" a.trim())

case 4
dim b as string="this is a test string"
dim a as string
console.writeline("A string is{0};"b)
c=b.replace("test","best")
console.writeline("the string replace is {0}",c}

case 5
console.writeline("enter the string si")
s1=console.readline()
console.writeline("enter the string s2")
s2=console.readline()
s3=s1+s2
console.writeline("concatenation of two string is {0}",s3)

case 6
console.wrieline("enter the string s1")
s1=console.readline()
s3=s1.goto string(0,5)
console.writeline("substring of a string is {0}";s3)

case 7
end
end select
end while
end sub
end module

42
RESULT

Thus the above program was executer and verified successfully

OUTPUT

enter first string


HARI
enter second string
HARAN
1.string concat
2.lower case
3.string upper case
4.string length
5.sub string
6.end
enter your choice
2
given string are lower case
hariharan
1.string concat
2.lower case
3.string upper case
4.string length
5.sub string
6.end
enter ur choice

43
44

You might also like