2 Replies - 559 Views - Last Post: 22 November 2007 - 12:32 PM Rate Topic: *---- 1 Votes

#1 hironakamura  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 20-September 07

Calculator Troubles

Post icon  Posted 22 November 2007 - 10:08 AM

Helo, i'm having quite a bit of trouble with a calculator i'm trying to make, i have the + working so i can get 7+7 to come up as 14 when i press =

But when i do something like 6-3 it comes up as 6 (the first number i entered)

It does the same with the divide and the multiply

heres the code for the Subtract

	Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
		'Make sure out input box has a value
		If TextBox1.Text.Length <> 0 Then
			'Check the value of our function flag
			If calcFunc = String.Empty Then 'Flag is empty
				'Assign the value in our input
				'box to our holder
				valHolder1 = CType(TextBox1.Text, Double)
				'Empty the input box
				TextBox1.Text = String.Empty
			Else 'Flag isnt empty
				'Call our calculate totals method
				calculatetotals()
			End If
			'Assign a value to our calc function flag
			calcFunc = "subtract"
			'Toggle the decimal flag
			hasDecimal = False
		End If
	End Sub


I use the same code for add but i change calcfunc = "subtract" to
calcfunc = "add"

calcfunc = "Multiply"
calcfunc = "Divide"

Etc


Can someone please help i've spent hours getting to where i am

thanks

Is This A Good Question/Topic? 0
  • +

Replies To: Calculator Troubles

#2 aceofspades686  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 6
  • View blog
  • Posts: 334
  • Joined: 08-October 07

Re: Calculator Troubles

Posted 22 November 2007 - 11:39 AM

From what I see, it may be something in your actual calculatetotals() function that's causing the problem. As is, we can't see what the flag actually does once its set.

This tutorial may also be of some help to you.
Was This Post Helpful? 0
  • +
  • -

#3 hironakamura  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 20-September 07

Re: Calculator Troubles

Posted 22 November 2007 - 12:32 PM

Thanks alot foir the help.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1