Wrox Programmer Forums
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 14th, 2004, 11:54 PM
Authorized User
 
Join Date: Aug 2004
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default Calculator Program

I am taking a self paced course on beginner VBA and I have run into a little snag. It is a simple calculator program that has 2 text boxes and 1 label. You enter numbers into both text boxes and hit the operator sign of choice(+,-,*,/) When I click the operator buttons simultaneously(just to check for errors), it comes up with an error saying overflow. The code I have is listed below. Does anybody see what I am doing wrong?

Option Compare Database

Private Sub cmdAddition_Click()

    lblAnswer.Caption = Val(txtInput1.Value) + Val(txtInput2.Value)

End Sub

Private Sub cmdDivide_Click()

    lblAnswer.Caption = Val(txtInput1.Value) / Val(txtInput2.Value)

End Sub

Private Sub cmdMultiply_Click()

    lblAnswer.Caption = Val(txtInput1.Value) * Val(txtInput2.Value)

End Sub

Private Sub cmdSubtract_Click()

    lblAnswer.Caption = Val(txtInput1.Value) + Val(txtInput2.Value)

End Sub


 
Old October 13th, 2004, 04:03 PM
Authorized User
 
Join Date: Oct 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jolzy
Default

txtInput1.Value ? what extention this for a text box? ".value"
txtInput1.Text Should be this ".Text I think this might be the problem

:)






Similar Threads
Thread Thread Starter Forum Replies Last Post
calculator mojtaba rashidi Visual Studio 2005 0 March 17th, 2008 07:29 AM
Calculator DweeLer Other Programming Languages 1 November 18th, 2005 08:13 AM
Setup Project: Program not added in Start>Program arif_1947 VS.NET 2002/2003 2 March 31st, 2005 06:40 AM
Investment calculator - help activexcode Classic ASP Basics 5 October 3rd, 2004 10:23 AM
calculator kale_tushar C++ Programming 1 January 28th, 2004 01:09 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.