Ello',
I'm teaching myself C# in a bit of a rush for an internship position at a software company - The tutorial I'm taking now is actually pretty good but some of the exercises are rather intuitive and this has been driving me insane for an hour.
I'm using Visual C# Express 2008 and attempting to build a Calculator so far everything is working but i cannot get the Decimal button to work (btnPoint).
Any help would be greatly appreciated - Sorry for such a stupid question.
In the underlying code i'm receiving an SystemFormat.Exception error during run time.
CODE
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
double total1 = 0;
double total2 = 0;
private void button4_Click(object sender, EventArgs e)
{
txtDisplay.Text = txtDisplay.Text + btn4.Text;
}
private void button1_Click(object sender, EventArgs e)
{
txtDisplay.Text = txtDisplay.Text+btn1.Text;
}
private void button2_Click(object sender, EventArgs e)
{
txtDisplay.Text = txtDisplay.Text + btn2.Text;
}
private void btn3_Click(object sender, EventArgs e)
{
txtDisplay.Text = txtDisplay.Text + btn3.Text;
}
private void btn5_Click(object sender, EventArgs e)
{
txtDisplay.Text = txtDisplay.Text + btn5.Text;
}
private void btn6_Click(object sender, EventArgs e)
{
txtDisplay.Text = txtDisplay.Text + btn6.Text;
}
private void btn7_Click(object sender, EventArgs e)
{
txtDisplay.Text = txtDisplay.Text + btn7.Text;
}
private void btn8_Click(object sender, EventArgs e)
{
txtDisplay.Text = txtDisplay.Text + btn8.Text;
}
private void btn9_Click(object sender, EventArgs e)
{
txtDisplay.Text = txtDisplay.Text + btn9.Text;
}
private void btn0_Click(object sender, EventArgs e)
{
txtDisplay.Text = txtDisplay.Text + btn0.Text;
}
private void btnClear_Click(object sender, EventArgs e)
{
txtDisplay.Clear();
}
private void btnPlus_Click(object sender, EventArgs e)
{
total1 = total1 + double.Parse(txtDisplay.Text);
txtDisplay.Clear();
}
private void btnEqual_Click(object sender, EventArgs e)
{
total2 = total1 + double.Parse(txtDisplay.Text);
txtDisplay.Text = total2.ToString();
total1 = 0;
}
private void btnPeriod_Click(object sender, EventArgs e)
{
txtDisplay.Text = txtDisplay.Text + double.Parse(btnPeriod.Text);
}
}
}