-
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
-
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
Similar Threads
-
By Gwen Smith in forum vb.announcements
Replies: 0
Last Post: 04-28-2003, 02:37 PM
-
By pwilmarth in forum .NET
Replies: 2
Last Post: 11-25-2002, 02:54 PM
-
By Dennis in forum VB Classic
Replies: 10
Last Post: 02-15-2001, 03:52 AM
-
By Toni Bisson in forum VB Classic
Replies: 8
Last Post: 01-19-2001, 05: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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks