Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6896689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:04:32+00:00 2026-05-27T07:04:32+00:00

im having a problem in my ASP .NET calculator project. I’m using VB10, all

  • 0

im having a problem in my ASP .NET calculator project. I’m using VB10,
all codes are working except for the equals button.
When my input is 1+1, the result will not display in the textbox.I’ve tried other solution but still does not display the result. Thanks in advance.

Here’s my code:

Partial Class webcalc
    Inherits System.Web.UI.Page
    Dim total As Double
    Dim total1 As Double
    Dim myOP As String
    Dim sign As Integer
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btn0_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn0.Click
        txtOutput.Text = txtOutput.Text + btn0.Text
    End Sub

    Protected Sub btn1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn1.Click
        txtOutput.Text = txtOutput.Text + btn1.Text
    End Sub

    Protected Sub btn2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn2.Click
        txtOutput.Text = txtOutput.Text + btn2.Text
    End Sub

    Protected Sub btn3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn3.Click
        txtOutput.Text = txtOutput.Text + btn3.Text
    End Sub

    Protected Sub btn4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn4.Click
        txtOutput.Text = txtOutput.Text + btn4.Text
    End Sub

    Protected Sub btn5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn5.Click
        txtOutput.Text = txtOutput.Text + btn5.Text
    End Sub

    Protected Sub btn6_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn6.Click
        txtOutput.Text = txtOutput.Text + btn6.Text
    End Sub

    Protected Sub btn7_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn7.Click
        txtOutput.Text = txtOutput.Text + btn7.Text
    End Sub

    Protected Sub btn8_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn8.Click
        txtOutput.Text = txtOutput.Text + btn8.Text
    End Sub

    Protected Sub btn9_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn9.Click
        txtOutput.Text = txtOutput.Text + btn9.Text
    End Sub

    Protected Sub btndot_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btndot.Click
        txtOutput.Text = txtOutput.Text + btndot.Text
    End Sub

    '============================================OPERATIONS============================================================

    Protected Sub btnplus_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnplus.Click
        total = Double.Parse(txtOutput.Text)
        txtOutput.Text = " "
        myOP = "+"
        sign = 1

    End Sub

    Protected Sub btnmin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnmin.Click
        total = Double.Parse(txtOutput.Text)
        txtOutput.Text = " "
        myOP = "-"
        sign = 2

    End Sub

    Protected Sub btnmul_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnmul.Click
        total = Double.Parse(txtOutput.Text)
        txtOutput.Text = " "
        myOP = "*"
        sign = 3

    End Sub

    Protected Sub btndiv_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btndiv.Click
        total = Double.Parse(txtOutput.Text)
        txtOutput.Text = " "
        myOP = "/"
        sign = 4
    End Sub

    Protected Sub btndel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btndel.Click
        txtOutput.Text = " "
    End Sub

    Protected Sub btneq_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btneq.Click
        Call eq()

    End Sub

    Public Sub eq()
        Select Case myOP

            Case Is = "+"
                total1 = total + Double.Parse(txtOutput.Text)
                'txtOutput.Text = total1.ToString()
                total = 0

            Case Is = "-"
                total1 = total - Double.Parse(txtOutput.Text)
                txtOutput.Text = total1.ToString()
                total = 0

            Case Is = "*"
                total1 = total * Double.Parse(txtOutput.Text)
                txtOutput.Text = total1.ToString()
                total = 0

            Case Is = "/"
                total1 = total / Double.Parse(txtOutput.Text)
                txtOutput.Text = total1.ToString()
                total = 0


        End Select

    End Sub
End Class
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:04:33+00:00Added an answer on May 27, 2026 at 7:04 am

    Seems to be working fine for me if i change your select case like this:

    myOP = CType(ViewState("myOP"), String)
    total = CType(ViewState("total"), Double)
    
    Select Case myOP
            Case "+"
                total1 = total + Double.Parse(txtOutput.Text)
                'txtOutput.Text = total1.ToString()
                total = 0
    
            Case "-"
                total1 = total - Double.Parse(txtOutput.Text)
                txtOutput.Text = total1.ToString()
                total = 0
    
            .....
            .....    
    End Select
    

    and change you operator button click event like this:

    Protected Sub btnplus_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnplus.Click        
            total = Double.Parse(txtOutput.Text)
            ViewState("total") = total
            txtOutput.Text = " "
            myOP = "+"
            ViewState("myOP") = myOP
            sign = 1
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having a very strange problem with an ASP.Net project using an Entity
I'm using ASP.NET MVC + NHibernate + Fluent NHibernate and having a problem with
I'm developing a website (using asp.net by the way) and I'm having a problem
I'm having a problem with JQGrid using ASP.NET MVC. I'm trying to follow this
I'm having a problem with a site where I'm using the ASP.NET SQL Membership
I'm using ASP.NET MVC 3 to build an application, but i'm having a problem
I'm using the Telerik Extensions for ASP.NET MVC 3 and I'm having a problem
I am having problem in using the source view of an asp.net page in
I am using ASP.NET 3.5 and we are having a problem with our website
I'm working on an ASP.NET MVC application. I'm having a problem where my Application_Error()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.