You are on page 1of 3

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.

vb"
Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
A :<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<br />
B :<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
<br />
C :<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<br />
<br />
&nbsp;<asp:Button ID="Button1"
runat="server" Text="Add" />
&nbsp;<asp:Button ID="Button2"
runat="server" Text="Div" />
&nbsp;<asp:Button ID="Button3"
runat="server" Text="Sub" />
&nbsp;<asp:Button ID="Button4"
runat="server" Text="Mul" />
</div>
</form>
</body>
</html>

Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols

Partial Class _Default


Inherits System.Web.UI.Page

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Button1.Click
Dim Parth As New localhost.WebService()
Dim a As Integer
Dim b As Integer
a = TextBox1.Text
b = TextBox2.Text
Dim c = Parth.Add(a, b)
TextBox3.Text = c.ToString()
End Sub

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Button2.Click
Dim Parth As New localhost.WebService()
Dim a As Integer
Dim b As Integer
a = TextBox1.Text
b = TextBox2.Text
Dim c = Parth.div(a, b)
TextBox3.Text = c.ToString()
End Sub

Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Button3.Click
Dim Parth As New localhost.WebService()
Dim a As Integer
Dim b As Integer
a = TextBox1.Text
b = TextBox2.Text
Dim c = Parth.subs(a, b)
TextBox3.Text = c.ToString()
End Sub

Protected Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Button4.Click
Dim Parth As New localhost.WebService()
Dim a As Integer
Dim b As Integer
a = TextBox1.Text
b = TextBox2.Text
Dim c = Parth.mul(a, b)
TextBox3.Text = c.ToString()
End Sub
End Class

Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class WebService
Inherits System.Web.Services.WebService

<WebMethod()> _
Public Function add(ByVal a As Integer, ByVal b As Integer) As Double
Return a + b
End Function
<WebMethod()> _
Public Function mul(ByVal a As Integer, ByVal b As Integer) As Double
Return a * b
End Function
<WebMethod()> _
Public Function div(ByVal a As Integer, ByVal b As Integer) As Double
Return a / b
End Function
<WebMethod()> _
Public Function subs(ByVal a As Integer, ByVal b As Integer) As Double
Return a - b
End Function
End Class

You might also like