Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Client Side Scripting
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 10-31-2009, 07:39 AM
  #1
benjaminpott
Chevalier (Level 6)
 
Join Date: Oct 2009
Posts: 58
iTrader: (0)
benjaminpott is an unknown quantity at this point
Visual Basic Calculator

I am trying to make a calculator...
Here is what I have done so far:

Code:
Public Class Form1
    Dim first As Integer
    Dim algebra As Decimal
    Dim holding_bay As Decimal
    Dim answer As Decimal

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        tb_1.Text = tb_1.Text & "1"
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        tb_1.Text = tb_1.Text & "2"
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        tb_1.Text = tb_1.Text & "3"
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        tb_1.Text = tb_1.Text & "4"
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        tb_1.Text = tb_1.Text & "5"
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        tb_1.Text = tb_1.Text & "6"
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        tb_1.Text = tb_1.Text & "7"
    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        tb_1.Text = tb_1.Text & "8"
    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        tb_1.Text = tb_1.Text & "9"
    End Sub

    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
        tb_1.Text = tb_1.Text & "0"
    End Sub

    Private Sub btn_dotpoint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_dotpoint.Click
        tb_1.Text = tb_1.Text & "."
    End Sub

    Private Sub btn_clear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_clear.Click
        tb_1.Text = ""
    End Sub

    Private Sub btn_plus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_plus.Click
        tb_1.Text = first
        first = "add"

        Process()
    End Sub

    Private Sub Process()
        Select Case algebra

            Case "add"
                holding_bay = Convert.ToDecimal(first)
                tb_1.Text = ""
                answer = holding_bay + first

        End Select
    End Sub

    Private Sub btn_equals_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_equals.Click
        tb_1.Text = answer

    End Sub
End Class
It won't work, I know that the code is wrong, I just don't know how to make it right.... anyone get any ideas?
benjaminpott is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-31-2009, 07:48 AM
  #2
coothead
~ bald headed old fart ~
 
coothead's Avatar
 
Join Date: Aug 2003
Location: chertsey, a small town 25 miles south west of london, england.
Posts: 7,918
iTrader: (0)
coothead is a splendid one to beholdcoothead is a splendid one to beholdcoothead is a splendid one to beholdcoothead is a splendid one to beholdcoothead is a splendid one to beholdcoothead is a splendid one to beholdcoothead is a splendid one to behold
Hi there benjaminpott,

I know nothing about VB and am not sure if anyone around here does either.
Whilst waiting for a reply here you may find this forum rather helpful...
__________________
coothead is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 11-01-2009, 03:34 AM
  #3
benjaminpott
Chevalier (Level 6)
 
Join Date: Oct 2009
Posts: 58
iTrader: (0)
benjaminpott is an unknown quantity at this point
haah ok thanks!
benjaminpott is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote

Reply
KEEP TABS
SPONSORS
 
Boxedart
 
 


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  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
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 07:03 AM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.