cheap calculator, OS X

A section for all development and testing programmes and customised browsers written by SillyDog701 community. Featured products including Donzilla, Firescape, DJGM Distro, and Netscape Streamline.

Moderator: Don_HH2K

Postby Don_HH2K » Thu 16 Feb, 2006 3:59 pm

CheapCalculator 0.2, .NET Framework 2.0 build. (I'd have built it in VB4 and made it Win32-enabled, but VB4 apparenty isn't getting along with me).

Image

I was very sloppy with the code, using all the default names and values for everything. Look for yourself -- it's [tt]if[/tt] programming.

Code: Select all
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If ComboBox1.Text = "+" Then TextBox3.Text = Val(TextBox1.Text) + Val(TextBox2.Text)
        If ComboBox1.Text = "-" Then TextBox3.Text = Val(TextBox1.Text) - Val(TextBox2.Text)
        If ComboBox1.Text = "*" Then TextBox3.Text = Val(TextBox1.Text) * Val(TextBox2.Text)
        If ComboBox1.Text = "/" Then TextBox3.Text = Val(TextBox1.Text) / Val(TextBox2.Text)
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TextBox3.Text = ((Val(TextBox1.Text) + Val(TextBox2.Text)) / 2)
    End Sub
End Class


All operations tested and working.
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060130 Donzilla/1.1PR1 (WML/1.3)
Laptop: HP Compaq nx6325 - Turion 64 X2 @ 2GHz, 2GB DDR2, 100GB HD, ATI Radeon X300, 15" LCD, Seven Pro
Handheld: Palm Treo 650 - Intel PXA270 @ 312MHz, 10MB RAM, 32MB flash, 2.7" LCD, Palm OS 5.4
User avatar
Don_HH2K
Moderator
Moderator
 
Posts: 5112
Joined: Sun 09 May, 2004 3:59 pm

Postby Pu7o » Fri 17 Feb, 2006 10:34 pm

Enjoy the JavaScript version :D
UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Tiger Mach-O Universal; en-US; rv:1.8.0.1) Gecko/20060216 Firefox/1.5.0.1 Firescape/0.2b2 wml/1.3
User avatar
Pu7o
Macfox
Macfox
 
Posts: 2014
Joined: Thu 06 Jan, 2005 12:03 pm
Location: Portugal

Postby Antony » Fri 17 Feb, 2006 10:59 pm

Thanks guys :-)

Now, I like the SillyDog701 Community, we have CheapCalculator for different platforms.

Don_HH2K wrote:I was very sloppy with the code, using all the default names and values for everything. Look for yourself -- it's [tt]if[/tt] programming.
Don, try [tt]switch ... case[/tt] (or similar if available), it will be easier and neater.
UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/417.9 (KHTML, like Gecko) Safari/417.8
User avatar
Antony
diamond member
diamond member
 
Posts: 14509
Joined: Tue 18 Jun, 2002 11:36 pm
Location: Sydney, Australia

Previous

Return to SD701 DevZone

Who is online

Registered users: Google [Bot]