Spiral PDF
Spiral PDF
Spiral PDF
1
ARITHMETIC OPERATION
AIM:
To write a VB.Net program to perform Arithmetic operation using Windows Application.
Source code
Public class Arithmetic operation
End sub
End sub
End sub
End sub
2
Textbox1.Text=” “
Textbox2.Text=” “
Textbox3.Text=” “
End sub
End class
Result:
3
INPUT 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
fact = 1
for I = 1 to n
fact =fact * i
next i
Msg Box(fact)
End sub
End Sub
End
5
End sub
End class
Result:
6
INPUT FORM DESIGN
7
PRIME NUMBER
Aim:
Source code:
Public class Form 1
Private Sub Button1_ click (Sender As object. e As Event args )Handles Button1.click
n = val (TextBox1.Text)
j= 1
j=0
end if
next i
if j= 1 then
else
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:
9
INPUT FORM DESIGN
10
ODD OR EVEN
Aim:
To Write a VB.Net program to seperation Odd or Even using windows
application.
Source code:
Result:
11
INPUT FORM DESIGN
12
BIGGEST TWO NUMBERS
Aim:
To Create a VB.Net program to perform Biggest Two Numbers using
windows Application.
Source code:
13
INPUT 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+""
Result:
Thus, the above program was executed and verified
Successfully.
18
INPUT 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
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
Result:
Thus, the above program was executed and verified Successfully.
22
INPUT 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
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
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
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
OUTPUT
43
44