Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. visual basic simple calculator

visual basic simple calculator

Scheduled Pinned Locked Moved Visual Basic
helpcsharplinqgraphics
5 Posts 5 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    terrable
    wrote on last edited by
    #1

    i am trying to make a working simple calculator in VB. i have 4 errors that i just can not figure out to save my life. can anyone help using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace projectfinal { public partial class Calculator : Form { bool Plus = false; bool Sub = false; bool Multiply = false; bool Divide = false; bool equals = false; public Calculator() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { //clears textbox and starts new problem if (equals) { textBox1.Text =""; equals = false; } textBox1.Text = textBox1.Text + "1"; } private void button2_Click(object sender, EventArgs e) { if (equals) { textBox1.Text =""; equals = false; } button2.Text = button2.Text + "2"; } private void button3_Click(object sender, EventArgs e) { if (equals) { textBox1.Text =""; equals = false; } button3.Text = button3.Text + "3"; } private void button4_Click(object sender, EventArgs e) { if (equals) { textBox1.Text = ""; equals = false; button4.Text = button4.Text + "4"; } } private void button5_Click(object sender, EventArgs e) { if (equals) { textBox1.Text =""; equals = false; } button5.Text = button5.Text + "5"; } private void button6_Click(object sender, EventArgs e) { if (equals) { textBox1.Text =""; equals = false; } button6.Text = button6.Text + "6"; } private void button7_Click(object sender, EventArgs e) { if (equals) { textBox1.Text =""; equals = false; } button7.Text = button7.Text + "7"; } private void button8_Click

    L L S 3 Replies Last reply
    0
    • T terrable

      i am trying to make a working simple calculator in VB. i have 4 errors that i just can not figure out to save my life. can anyone help using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace projectfinal { public partial class Calculator : Form { bool Plus = false; bool Sub = false; bool Multiply = false; bool Divide = false; bool equals = false; public Calculator() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { //clears textbox and starts new problem if (equals) { textBox1.Text =""; equals = false; } textBox1.Text = textBox1.Text + "1"; } private void button2_Click(object sender, EventArgs e) { if (equals) { textBox1.Text =""; equals = false; } button2.Text = button2.Text + "2"; } private void button3_Click(object sender, EventArgs e) { if (equals) { textBox1.Text =""; equals = false; } button3.Text = button3.Text + "3"; } private void button4_Click(object sender, EventArgs e) { if (equals) { textBox1.Text = ""; equals = false; button4.Text = button4.Text + "4"; } } private void button5_Click(object sender, EventArgs e) { if (equals) { textBox1.Text =""; equals = false; } button5.Text = button5.Text + "5"; } private void button6_Click(object sender, EventArgs e) { if (equals) { textBox1.Text =""; equals = false; } button6.Text = button6.Text + "6"; } private void button7_Click(object sender, EventArgs e) { if (equals) { textBox1.Text =""; equals = false; } button7.Text = button7.Text + "7"; } private void button8_Click

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Some suggestions: 1. Put your code between <pre></pre> tags for readability; use the "code block" button in this editor. 2. Tell us what the errors are, we cannot see the output of your compilation from here, nor can we guess what might be going wrong.

      It's time for a new signature.

      1 Reply Last reply
      0
      • T terrable

        i am trying to make a working simple calculator in VB. i have 4 errors that i just can not figure out to save my life. can anyone help using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace projectfinal { public partial class Calculator : Form { bool Plus = false; bool Sub = false; bool Multiply = false; bool Divide = false; bool equals = false; public Calculator() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { //clears textbox and starts new problem if (equals) { textBox1.Text =""; equals = false; } textBox1.Text = textBox1.Text + "1"; } private void button2_Click(object sender, EventArgs e) { if (equals) { textBox1.Text =""; equals = false; } button2.Text = button2.Text + "2"; } private void button3_Click(object sender, EventArgs e) { if (equals) { textBox1.Text =""; equals = false; } button3.Text = button3.Text + "3"; } private void button4_Click(object sender, EventArgs e) { if (equals) { textBox1.Text = ""; equals = false; button4.Text = button4.Text + "4"; } } private void button5_Click(object sender, EventArgs e) { if (equals) { textBox1.Text =""; equals = false; } button5.Text = button5.Text + "5"; } private void button6_Click(object sender, EventArgs e) { if (equals) { textBox1.Text =""; equals = false; } button6.Text = button6.Text + "6"; } private void button7_Click(object sender, EventArgs e) { if (equals) { textBox1.Text =""; equals = false; } button7.Text = button7.Text + "7"; } private void button8_Click

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        on top of what Richard said, don't enter that amount of code all at once; start with a subset and get that working; working more incrementally will save you lots of time, so you can learn while doing, and not repeat earlier mistakes. I compile and run every two minutes, and I don't add code when what I have isn't working already to some extent. :)

        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


        Prolific encyclopedia fixture proof-reader browser patron addict?
        We all depend on the beast below.


        modified on Monday, April 26, 2010 7:07 PM

        1 Reply Last reply
        0
        • T terrable

          i am trying to make a working simple calculator in VB. i have 4 errors that i just can not figure out to save my life. can anyone help using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace projectfinal { public partial class Calculator : Form { bool Plus = false; bool Sub = false; bool Multiply = false; bool Divide = false; bool equals = false; public Calculator() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { //clears textbox and starts new problem if (equals) { textBox1.Text =""; equals = false; } textBox1.Text = textBox1.Text + "1"; } private void button2_Click(object sender, EventArgs e) { if (equals) { textBox1.Text =""; equals = false; } button2.Text = button2.Text + "2"; } private void button3_Click(object sender, EventArgs e) { if (equals) { textBox1.Text =""; equals = false; } button3.Text = button3.Text + "3"; } private void button4_Click(object sender, EventArgs e) { if (equals) { textBox1.Text = ""; equals = false; button4.Text = button4.Text + "4"; } } private void button5_Click(object sender, EventArgs e) { if (equals) { textBox1.Text =""; equals = false; } button5.Text = button5.Text + "5"; } private void button6_Click(object sender, EventArgs e) { if (equals) { textBox1.Text =""; equals = false; } button6.Text = button6.Text + "6"; } private void button7_Click(object sender, EventArgs e) { if (equals) { textBox1.Text =""; equals = false; } button7.Text = button7.Text + "7"; } private void button8_Click

          S Offline
          S Offline
          Steven J Jowett
          wrote on last edited by
          #4

          terrable wrote:

          i am trying to make a working simple calculator in VB

          I think you're biggest problem is that the code you provided is actually C# and not VB

          Steve Jowett ------------------------- Real programmers don't comment their code. If it was hard to write, it should be hard to read.

          M 1 Reply Last reply
          0
          • S Steven J Jowett

            terrable wrote:

            i am trying to make a working simple calculator in VB

            I think you're biggest problem is that the code you provided is actually C# and not VB

            Steve Jowett ------------------------- Real programmers don't comment their code. If it was hard to write, it should be hard to read.

            M Offline
            M Offline
            Michel Godfroid
            wrote on last edited by
            #5

            Steven J Jowett wrote:

            I think you're biggest problem is that the code you provided is actually C# and not VB

            We have a winner! :laugh:

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups