Dear all, I'm starting on C# now. I had a problem in tackling a question my lecturer asked me to do. Below is the GUI.

Click Here

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 button1_Click(object sender, EventArgs e)
        {
            double num1;
            double num2;
            double answer;

            num1 = double.Parse(textBox1.Text);
            num2 = double.Parse(textBox2.Text);


            textBox4.Text = Convert.ToString(answer);
        }
    }
}

I will need to add/subtract/multiple/divide first and second number so that it will produce --> (first number + the operation + second number = the answer).

The problem is i need to select the operation by clicking on the + , - , * , / symbols on the textbox. I could do it easily by using radio button or etc but my lecturer insist on this format. Please do assist for the coding of "operation" selection. Thank you.

You can use a switch statement.

Click Here

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.