Design a simple calculator application in C# using Windows Forms. The calculator should support basic arithmetic operations like addition, subtraction, multiplication, and division. Include buttons for digits 0-9, decimal point, clear, and equal sign. Ensure proper handling of edge cases such as division by zero.
PLAINFORMAT
using System;
using System.Windows.Forms;

namespace SimpleCalculator
{
    public partial class Form1 : Form
    {
        private double currentValue = 0;
        private double storedValue = 0;
        private char operation = '\0';

        public Form1()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, EventArgs e)
        {
            Button button = (Button)sender;
            if (button.Text == ".")
            {
                if (!textBoxResult.Text.Contains("."))
                    textBoxResult.Text += ".";
            }
            else
            {
                textBoxResult.Text += button.Text;
            }
        }

        private void ButtonClear_Click(object sender, EventArgs e)
        {
            textBoxResult.Clear();
            currentValue = 0;
            storedValue = 0;
            operation = '\0';
        }

        private void ButtonOperation_Click(object sender, EventArgs e)
        {
            Button button = (Button)sender;
            operation = button.Text[0];
            double.TryParse(textBoxResult.Text, out storedValue);
            textBoxResult.Clear();
        }

        private void ButtonEqual_Click(object sender, EventArgs e)
        {
            double.TryParse(textBoxResult.Text, out currentValue);

            switch (operation)
            {
                case '+':
                    textBoxResult.Text = (storedValue + currentValue).ToString();
                    break;
                case '-':
                    textBoxResult.Text = (storedValue - currentValue).ToString();
                    break;
                case '*':
                    textBoxResult.Text = (storedValue * currentValue).ToString();
                    break;
                case '/':
                    if (currentValue != 0)
                        textBoxResult.Text = (storedValue / currentValue).ToString();
                    else
                        MessageBox.Show("Cannot divide by zero.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    break;
            }
        }
    }
}