Hello

1.      新建web服务Service1,计算x+y

    <WebMethod()> Public Function WebAdd(ByVal x As Integer, ByVal y As Integer) As Integer

        Return x + y

    End Function

 

2.      新建window应用程序  添加控件 textbox1,textbox2,textbox3,button1

     

      Dim
MathServiceClass As New localhost.Service1

   

      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

        ' Create instances of the operands and result.

        Dim x, y, z As Integer

        ' Parse the contents of the text boxes into integers.

        x = Integer.Parse(TextBox1.Text)

        y = Integer.Parse(TextBox2.Text)

        ' Call the WebAdd Web service method from the instance of the Web service.

        z = MathServiceClass.WebAdd(x, y)

        TextBox3.Text = z.ToString

      End Sub

 

posted on 2006-07-21 21:15  WaikingLiu  阅读(277)  评论(0)    收藏  举报