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 WindowsFormsApplication8
{
    public partial class Form1 : Form
    {
        double deger1;
        double deger2;
        char isaret;
        public Form1()
        {
            InitializeComponent();
          
        }

        private void button_1_Click(object sender, EventArgs e)
        {
            string a = ("1");
           textBox1.AppendText(a);

           
            
        }

        private void button_2_Click(object sender, EventArgs e)
        {
            string a = ("2");
            textBox1.AppendText(a);

        }

        private void button_3_Click(object sender, EventArgs e)
        {
            string a = ("3");
            textBox1.AppendText(a);

        }

        private void button_4_Click(object sender, EventArgs e)
        {
            string a = ("4");
            textBox1.AppendText(a);

        }

        private void button_5_Click(object sender, EventArgs e)
        {
            string a = ("5");
            textBox1.AppendText(a);

        }

        private void button_6_Click(object sender, EventArgs e)
        {
            string a = ("6");
            textBox1.AppendText(a);

        }

        private void button_7_Click(object sender, EventArgs e)
        {
            string a = ("7");
            textBox1.AppendText(a);

        }

        private void button_8_Click(object sender, EventArgs e)
        {
            string a = ("8");
            textBox1.AppendText(a);

        }

        private void button_9_Click(object sender, EventArgs e)
        {
            string a = ("9");
            textBox1.AppendText(a);

        }

        private void button_0_Click(object sender, EventArgs e)
        {
            string a = ("0");
            textBox1.AppendText(a);

        }

        private void button_comma_Click(object sender, EventArgs e)
        {
            string a = (".");
            textBox1.AppendText(a);

        }

        private void button_sqrt_Click(object sender, EventArgs e)
        {
           

       double  a=double.Parse(textBox1.Text);

       a = Math.Sqrt(a);

       textBox1.Text = a.ToString();
            

           

        }

        private void button_topla_Click(object sender, EventArgs e)
        {
            
          
            deger1 = double.Parse(textBox1.Text);
            textBox1.Clear();
            isaret = '+';
       
            
        }

        private void button_cikart_Click(object sender, EventArgs e)
        {
            string a = ("-");
            textBox1.AppendText(a);
            isaret = '-';

        }

        private void button_carp_Click(object sender, EventArgs e)
        {
            string a = ("*");
            textBox1.AppendText(a);
        }

        private void button_bol_Click(object sender, EventArgs e)
        {
            string a = ("/");
            textBox1.AppendText(a);
        }

        private void button_kalan_Click(object sender, EventArgs e)
        {
            string a = ("%");
            textBox1.AppendText(a);
        }

        private void button_square_Click(object sender, EventArgs e)
        {
           string a = ("^");
            textBox1.AppendText(a);
          
        }

        private void button_equalto_Click(object sender, EventArgs e)
        {

            deger2 = double.Parse(textBox1.Text);
            textBox1.Clear();

            double cevap = 0;
            string a;

            switch (isaret)
            {
                case '+':
                    cevap = deger1 + deger2;
                    break;
                case '-':
                    cevap = deger1 - deger2;
                    break;

            }

            cevap = deger2 + deger1;

            a=cevap.ToString();
            textBox1.Text(a);

            }

         

        }

        private void button_clear_Click(object sender, EventArgs e)
        {
            textBox1.Clear();
        }

      
    }
}

hello. first of all, its not a homework. just self-study.

so please can you help me to solve the button_equalto_Click(marked red) problem?

Hold on, I'll just use my magic telepathic powers to find out what errors you're getting and work out what the problem is....
*mentally strains*
Nope sorry couldn't do it. My magic has failed me :'(

Error 1 Non-invocable member 'System.Windows.Forms.Control.Text' cannot be used like a method.


Error 2 'System.Windows.Forms.TextBox.Text' is a 'property' but is used like a 'method'

I'm guessing that Error 1 is here textBox1.Text(a); This should be textBox1.Text = a; This will also clear the other error.

However, you will also get a run-time error here deger2 = double.Parse(textBox1.Text); because double does not parse mathematical expressions.
You will have to parse the sums yourself.

However, there are a couple of code samples on how to do this using CodeDom.
See [POST=1269042]this post[/POST] for the links.

it would be nice if you can give me the line ur error is indicating.

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 WindowsFormsApplication8
{
    public partial class Form1 : Form
    {
        double deger1;
        double deger2;
        char isaret;
        public Form1()
        {
            InitializeComponent();
          
        }

        private void button_1_Click(object sender, EventArgs e)
        {
            string a = ("1");
           textBox1.AppendText(a);

           
            
        }

        private void button_2_Click(object sender, EventArgs e)
        {
            string a = ("2");
            textBox1.AppendText(a);

        }

        private void button_3_Click(object sender, EventArgs e)
        {
            string a = ("3");
            textBox1.AppendText(a);

        }

        private void button_4_Click(object sender, EventArgs e)
        {
            string a = ("4");
            textBox1.AppendText(a);

        }

        private void button_5_Click(object sender, EventArgs e)
        {
            string a = ("5");
            textBox1.AppendText(a);

        }

        private void button_6_Click(object sender, EventArgs e)
        {
            string a = ("6");
            textBox1.AppendText(a);

        }

        private void button_7_Click(object sender, EventArgs e)
        {
            string a = ("7");
            textBox1.AppendText(a);

        }

        private void button_8_Click(object sender, EventArgs e)
        {
            string a = ("8");
            textBox1.AppendText(a);

        }

        private void button_9_Click(object sender, EventArgs e)
        {
            string a = ("9");
            textBox1.AppendText(a);

        }

        private void button_0_Click(object sender, EventArgs e)
        {
            string a = ("0");
            textBox1.AppendText(a);

        }

        private void button_comma_Click(object sender, EventArgs e)
        {
            string a = (",");
            textBox1.AppendText(a);

        }

        private void button_sqrt_Click(object sender, EventArgs e)
        {
           

       double  a=double.Parse(textBox1.Text);

       a = Math.Sqrt(a);

       textBox1.Text = a.ToString();
            

           

        }

        private void button_topla_Click(object sender, EventArgs e)
        {
            
          
            deger1 = double.Parse(textBox1.Text);
            textBox1.Clear();
            isaret = '+';
       
            
        }

        private void button_cikart_Click(object sender, EventArgs e)
        {

            deger1 = double.Parse(textBox1.Text);
            textBox1.Clear();
            isaret = '-';

        }

        private void button_carp_Click(object sender, EventArgs e)
        {
            deger1 = double.Parse(textBox1.Text);
            textBox1.Clear();
            isaret = '*';
        }

        private void button_bol_Click(object sender, EventArgs e)
        {
            deger1 = double.Parse(textBox1.Text);
            textBox1.Clear();
            isaret = '/';
        }

        private void button_kalan_Click(object sender, EventArgs e)
        {
            deger1 = double.Parse(textBox1.Text);
            textBox1.Clear();
            isaret = '%';
        }

        private void button_square_Click(object sender, EventArgs e)
        {
            deger1 = double.Parse(textBox1.Text);
            textBox1.Clear();
            isaret = '^';
          
        }

        private void button_equalto_Click(object sender, EventArgs e)
        {

            deger2 = double.Parse(textBox1.Text);
            textBox1.Clear();

            double cevap = 0;
            string a;

            switch (isaret)
            {
                case '+':
                    cevap = deger1 + deger2;
                    break;
                case '-':
                    cevap = deger1 - deger2;
                    break;
                case '*':
                    cevap = deger1 * deger2;
                    break;
                case '/':
                    cevap = deger1 / deger2;
                    break;
                case '%':
                    cevap = deger1 % deger2;
                    break;
                case '^':
                    cevap = (Math.Pow(deger1,deger2));
                    break;



            }

         

            a=cevap.ToString();
            textBox1.Text = a; 

         

        }

        private void button_clear_Click(object sender, EventArgs e)
        {
            textBox1.Clear();
        }

      
    }

}

thank you. it just works (fine for now :) )

Your welcome.
Please mark solved.

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.