NEED HELP WITH CALCULATOR WEB SERVICE

Ask a Question related to ASP.NET Web Services, Design and Development.

  1. #1

    Default NEED HELP WITH CALCULATOR WEB SERVICE

    Whats up guys, i am having difficulties coding the plus sign button on
    my aspx page to store variable1, clear textbox, and store variable2
    then call a web service to add both variables

    my code so far is:
    <%@ Page Language="VB" %>
    <%@ import Namespace="WebSCalculator" %>
    <script runat="server">

    Private Sub btnZero_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles btnzero.Click

    txtDisplay.Text = txtDisplay.Text & btnzero.Text


    End Sub

    Private Sub btnone_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles btnone.Click

    txtDisplay.Text = txtDisplay.Text & btnone.Text

    End Sub

    Private Sub btntwo_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles btntwo.Click

    txtDisplay.Text = txtDisplay.Text & btntwo.Text

    End Sub

    Private Sub btnthree_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles btnthree.Click

    txtDisplay.Text = txtDisplay.Text & btnthree.Text

    End Sub

    Private Sub btnfour_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles btnfour.Click

    txtDisplay.Text = txtDisplay.Text & btnfour.Text

    End Sub

    Private Sub btnfive_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles btnfive.Click

    txtDisplay.Text = txtDisplay.Text & btnfive.Text

    End Sub



    Private Sub btnsix_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles btnsix.Click

    txtDisplay.Text = txtDisplay.Text & btnsix.Text

    End Sub

    Private Sub btnseven_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles btnseven.Click

    txtDisplay.Text = txtDisplay.Text & btnseven.Text

    End Sub

    Private Sub btneight_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles btneight.Click

    txtDisplay.Text = txtDisplay.Text & btneight.Text

    End Sub

    Private Sub btnnine_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles btnnine.Click

    txtDisplay.Text = txtDisplay.Text & btnnine.Text

    End Sub

    Private Sub cmdclear_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles cmdclear.Click

    txtDisplay.Text = ""

    End Sub
    Private Sub period_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles period.Click

    txtDisplay.Text = txtDisplay.Text +"."

    End Sub




    Private Sub cmdPlus_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles cmdPlus.Click
    Dim Number1 as Double
    Dim Number2 as Double
    number1 = 0
    Number2 = 0
    number1 = number1 & txtdisplay.text
    txtdisplay.text = ""




    End Sub

    </script>
    <html>
    <head>
    </head>
    <body>
    <form runat="server">
    <p align="center">
    <asp:TextBox id="Txtdisplay" runat="server"></asp:TextBox>
    </p>
    <p align="center">
    <asp:Button id="btnseven" runat="server" Width="15px"
    Text="7"></asp:Button>
    <asp:Button id="btneight" runat="server"
    Text="8"></asp:Button>
    <asp:Button id="btnnine" runat="server"
    Text="9"></asp:Button>
    <asp:Button id="divide" runat="server"
    Text="/"></asp:Button>
    <asp:Button id="cmdclear" runat="server"
    Text="c"></asp:Button>
    </p>
    <p align="center">
    <asp:Button id="btnfour" runat="server"
    Text="4"></asp:Button>
    <asp:Button id="btnfive" runat="server"
    Text="5"></asp:Button>
    <asp:Button id="btnsix" runat="server"
    Text="6"></asp:Button>
    <asp:Button id="multiply" runat="server"
    Text="*"></asp:Button>
    </p>
    <p align="center">
    <asp:Button id="btnthree" runat="server"
    Text="3"></asp:Button>
    <asp:Button id="btntwo" runat="server" Width="15px"
    Text="2"></asp:Button>
    <asp:Button id="btnone" runat="server"
    Text="1"></asp:Button>
    <asp:Button id="cmdplus" runat="server"
    Text="+"></asp:Button>
    </p>
    <p dir="ltr" style="MARGIN-RIGHT: 0px" align="center">
    <asp:Button id="btnzero" runat="server"
    Text="0"></asp:Button>
    <asp:Button id="period" runat="server"
    Text="."></asp:Button>
    <asp:Button id="minus" runat="server"
    Text="-"></asp:Button>
    <asp:Button id="cmdequal" runat="server"
    Text="="></asp:Button>
    </p>
    <!-- Insert content here -->
    </form>
    </body>
    </html>

    conspawn Guest

  2. Similar Questions and Discussions

    1. love calculator in PHP
      If anyone would like the source code to my love calculator, I will e-mail it to them. The algorithm is very easy to change. Demo is at...
    2. need help with rate calculator
      I have to create an online quote system for my cousin's disco. His rates changedepending on the hour and I need the price calculator to reflect that...
    3. Calculator malfunctions
      I have a new Compaq EVO D310 P4, .99GB RAM, with WinXP Pro (incl SP1) installed. The calc.exe file is acting buggy for me. I use it many times a...
    4. Interactive Calculator
      My business has asked me to develop an online interactive calculator. It would work with 4 or 5 inter-dependent variables to give results. e.g.,...
    5. Calculator Gone
      I upgraded to Windows XP Professional a few weeks ago and I cannot seem to find the calculator at all. Does anyone know where I could download...
  3. #2

    Default Re: NEED HELP WITH CALCULATOR WEB SERVICE

    Did you want to tell us exactly what "difficulties" you were having?


    "conspawn" <conspawn@aol.com> wrote in message
    news:1116962199.400691.320770@g49g2000cwa.googlegr oups.com...
    > Whats up guys, i am having difficulties coding the plus sign button on
    > my aspx page to store variable1, clear textbox, and store variable2
    > then call a web service to add both variables
    >
    > my code so far is:
    > <%@ Page Language="VB" %>
    > <%@ import Namespace="WebSCalculator" %>
    > <script runat="server">
    >
    > Private Sub btnZero_Click(ByVal sender As System.Object, _
    > ByVal e As System.EventArgs) _
    > Handles btnzero.Click
    >
    > txtDisplay.Text = txtDisplay.Text & btnzero.Text
    >
    >
    > End Sub
    >
    > Private Sub btnone_Click(ByVal sender As System.Object, _
    > ByVal e As System.EventArgs) _
    > Handles btnone.Click
    >
    > txtDisplay.Text = txtDisplay.Text & btnone.Text
    >
    > End Sub
    >
    > Private Sub btntwo_Click(ByVal sender As System.Object, _
    > ByVal e As System.EventArgs) _
    > Handles btntwo.Click
    >
    > txtDisplay.Text = txtDisplay.Text & btntwo.Text
    >
    > End Sub
    >
    > Private Sub btnthree_Click(ByVal sender As System.Object, _
    > ByVal e As System.EventArgs) _
    > Handles btnthree.Click
    >
    > txtDisplay.Text = txtDisplay.Text & btnthree.Text
    >
    > End Sub
    >
    > Private Sub btnfour_Click(ByVal sender As System.Object, _
    > ByVal e As System.EventArgs) _
    > Handles btnfour.Click
    >
    > txtDisplay.Text = txtDisplay.Text & btnfour.Text
    >
    > End Sub
    >
    > Private Sub btnfive_Click(ByVal sender As System.Object, _
    > ByVal e As System.EventArgs) _
    > Handles btnfive.Click
    >
    > txtDisplay.Text = txtDisplay.Text & btnfive.Text
    >
    > End Sub
    >
    >
    >
    > Private Sub btnsix_Click(ByVal sender As System.Object, _
    > ByVal e As System.EventArgs) _
    > Handles btnsix.Click
    >
    > txtDisplay.Text = txtDisplay.Text & btnsix.Text
    >
    > End Sub
    >
    > Private Sub btnseven_Click(ByVal sender As System.Object, _
    > ByVal e As System.EventArgs) _
    > Handles btnseven.Click
    >
    > txtDisplay.Text = txtDisplay.Text & btnseven.Text
    >
    > End Sub
    >
    > Private Sub btneight_Click(ByVal sender As System.Object, _
    > ByVal e As System.EventArgs) _
    > Handles btneight.Click
    >
    > txtDisplay.Text = txtDisplay.Text & btneight.Text
    >
    > End Sub
    >
    > Private Sub btnnine_Click(ByVal sender As System.Object, _
    > ByVal e As System.EventArgs) _
    > Handles btnnine.Click
    >
    > txtDisplay.Text = txtDisplay.Text & btnnine.Text
    >
    > End Sub
    >
    > Private Sub cmdclear_Click(ByVal sender As System.Object, _
    > ByVal e As System.EventArgs) _
    > Handles cmdclear.Click
    >
    > txtDisplay.Text = ""
    >
    > End Sub
    > Private Sub period_Click(ByVal sender As System.Object, _
    > ByVal e As System.EventArgs) _
    > Handles period.Click
    >
    > txtDisplay.Text = txtDisplay.Text +"."
    >
    > End Sub
    >
    >
    >
    >
    > Private Sub cmdPlus_Click(ByVal sender As System.Object, _
    > ByVal e As System.EventArgs) _
    > Handles cmdPlus.Click
    > Dim Number1 as Double
    > Dim Number2 as Double
    > number1 = 0
    > Number2 = 0
    > number1 = number1 & txtdisplay.text
    > txtdisplay.text = ""
    >
    >
    >
    >
    > End Sub
    >
    > </script>
    > <html>
    > <head>
    > </head>
    > <body>
    > <form runat="server">
    > <p align="center">
    > <asp:TextBox id="Txtdisplay" runat="server"></asp:TextBox>
    > </p>
    > <p align="center">
    > <asp:Button id="btnseven" runat="server" Width="15px"
    > Text="7"></asp:Button>
    > <asp:Button id="btneight" runat="server"
    > Text="8"></asp:Button>
    > <asp:Button id="btnnine" runat="server"
    > Text="9"></asp:Button>
    > <asp:Button id="divide" runat="server"
    > Text="/"></asp:Button>
    > <asp:Button id="cmdclear" runat="server"
    > Text="c"></asp:Button>
    > </p>
    > <p align="center">
    > <asp:Button id="btnfour" runat="server"
    > Text="4"></asp:Button>
    > <asp:Button id="btnfive" runat="server"
    > Text="5"></asp:Button>
    > <asp:Button id="btnsix" runat="server"
    > Text="6"></asp:Button>
    > <asp:Button id="multiply" runat="server"
    > Text="*"></asp:Button>
    > </p>
    > <p align="center">
    > <asp:Button id="btnthree" runat="server"
    > Text="3"></asp:Button>
    > <asp:Button id="btntwo" runat="server" Width="15px"
    > Text="2"></asp:Button>
    > <asp:Button id="btnone" runat="server"
    > Text="1"></asp:Button>
    > <asp:Button id="cmdplus" runat="server"
    > Text="+"></asp:Button>
    > </p>
    > <p dir="ltr" style="MARGIN-RIGHT: 0px" align="center">
    > <asp:Button id="btnzero" runat="server"
    > Text="0"></asp:Button>
    > <asp:Button id="period" runat="server"
    > Text="."></asp:Button>
    > <asp:Button id="minus" runat="server"
    > Text="-"></asp:Button>
    > <asp:Button id="cmdequal" runat="server"
    > Text="="></asp:Button>
    > </p>
    > <!-- Insert content here -->
    > </form>
    > </body>
    > </html>
    >

    Scott M. Guest

  4. #3

    Default Re: NEED HELP WITH CALCULATOR WEB SERVICE

    yea how to code the plus button
    i know it has to be something like this where am i going wrong?
    Private Sub cmdPlus_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles cmdPlus.Click
    Dim Number1 as Double
    Dim Number2 as Double
    dim MyService as New WebSCalculator.Calculator

    If Session("Number1Entered") = "Y" then
    Session("Number2") = txtdisplay.text

    Session("Number1") =
    System.Convert.ToString(MyService.Add(System.Conve rt.ToDouble(number1),system.Convert.ToDouble(numbe r2))
    )'Call your web method as it returns a double value back

    Session("Number2") = ""
    Session("Number1Entered") = "Y"
    txtdisplay.text = Session("Number1") ' Show the answer returned
    from your web method
    End if
    Session("Number1") = txtdisplay.text
    Session("Number1Entered") = "Y"
    Session("Number2") = ""
    txtdisplay.text = Session("Number2") ' Clear the display so user
    can enter number 2

    End Sub

    conspawn Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139