GIDForums  

Go Back   GIDForums > Computer Programming Forums > Miscellaneous Programming Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 11-Feb-2008, 16:03
xsurvivor1fanx xsurvivor1fanx is offline
New Member
 
Join Date: Feb 2008
Posts: 2
xsurvivor1fanx is on a distinguished road

Building Postfix Calculator


Hi, I'm building a "postfix" calculator for a comp. programming class, and I'm terrible stuck. I have the basic calculator put together, but some of the instructions for the code I am not able to understand. I was wondering if someone could help me. These are the instructions I'm having trouble with:

1. Update txtDisplay to show the current value of the Operand.
2. Modify the event handlers that handle Click events for btnEnter, btnAdd, btnSubtract, btnMultiply, btnDivide so that they update the new TextBox whenever the accumulator is updated.
3. Bring the focus back to txtDisplay using txtDisplay.focus()
4. Select all text in txtDisplay by using txtDisplay.SelectAll()
5. Whenever a button is clicked, the detail of the operation should be recorded in the ListBox. To implement these changes, review how to add a line into a ListBox and how to concatenate strings????

As you can see, I'm terrible confused, so help with any of all of these would be much, much appreciated. Thanks!
  #2  
Old 11-Feb-2008, 18:22
xsurvivor1fanx xsurvivor1fanx is offline
New Member
 
Join Date: Feb 2008
Posts: 2
xsurvivor1fanx is on a distinguished road

Re: Building Postfix Calculator Help


This is the code I have, btw.

VB / Visual Basic Code:
Public Class frmCalc

    Dim accumulator As Double = 0.0
    Dim operand As Double = 0.0

    Private Sub txtDisplay_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtDisplay.Leave
        operand = CDbl(txtDisplay.Text)
    End Sub

    Private Sub btnEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnter.Click
        accumulator = operand
    End Sub

    Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
        accumulator += operand
        operand = accumulator
        txtDisplay.Text = operand
    End Sub

    Private Sub btnSubtract_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubtract.Click
        accumulator -= operand
        operand = accumulator
        txtDisplay.Text = operand
    End Sub

    Private Sub btnMultiply_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMultiply.Click
        accumulator *= operand
        operand = accumulator
        txtDisplay.Text = operand
    End Sub

    Private Sub btnDivide_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDivide.Click
        accumulator /= operand
        operand = accumulator
        txtDisplay.Text = operand
    End Sub

    Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
        Dim accumulator = 0.0
        Dim operand = 0.0
    End Sub
End Class
Last edited by LuciWiz : 12-Feb-2008 at 05:48. Reason: Please insert your Visual Basic code between [vb] & [/vb] tags
 
 

Recent GIDBlogProblems with the Navy (Officers) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help, building this program idea Falcone C++ Forum 12 07-Dec-2007 10:13
How do I divi up "replies" into pages on a forum that I'm building? compuXP MySQL / PHP Forum 3 14-Jul-2007 18:08
Building Flash Gallery without programming – The solution a2flash Member Announcements, Advertisements & Offers 0 13-Mar-2006 07:50
infix to postfix Kacyndra C++ Forum 2 15-Aug-2005 10:44
"cannot convert from 'class X *' to 'class X'" ?? hard2clone C++ Forum 11 04-Aug-2005 06:45

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 02:16.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.