Windows calculator


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Windows calculator

  1. #1
    Join Date
    Sep 2005
    Posts
    2

    Unhappy Windows calculator

    Hey ppl,

    can anybody help me in makeing a calculator like the windows calculator i need to know the code for the = button i have the first line,

    Private Sub btnequals_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnequals.Click
    total2 = total1 + (txtdisplay.Text)

    End Sub

    i just cant work out the next to

    thanks cutey_kira
    Edit/Delete Message

  2. #2
    Join Date
    Oct 2005
    Location
    York, PA (work in Baltimore, MD)
    Posts
    6
    The equals button should use the same code as hitting an operator for the second/third/etc time. For example:

    3 * 3 * 3 --> after hitting * for the 2nd time you'd expect the screen to display 9
    3 + 3 + 3 --> after hitting + for the 2nd time you'd expect the screen to display 6
    3 + 3 - 3 --> same as above

    Hitting = should do the same thing. Basically:
    if (priorOperator = '+') then
    result = priorTotal + txtDisplay.Text
    else if (priorOperator = '-') then
    result = priorTotal - txtDisplay.Text
    else if (priorOperator = '/') then
    result = priorTotal / txtDisplay.Text
    else if (priorOperator = '*') then
    result = priorTotal * txtDisplay.Text

    Hope this helps,
    Josh Lindenmuth
    Josh Lindenmuth - Payce Payroll

Similar Threads

  1. REAL Software Ships REALbasic 5 for WINDOWS
    By Gwen Smith in forum vb.announcements
    Replies: 0
    Last Post: 04-28-2003, 03:37 PM
  2. Replies: 2
    Last Post: 11-25-2002, 03:54 PM
  3. ?API NT Compatability?
    By Dennis in forum VB Classic
    Replies: 10
    Last Post: 02-15-2001, 04:52 AM
  4. Replies: 8
    Last Post: 01-19-2001, 06:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center