2
Reply

help me about calculator app in C# language

pooya monadi

pooya monadi

Nov 3 2013 4:59 AM
815
I know how to code calculator in C# but i dont know how solve this problem for my app.
i want that use Enter as '=' but i try to run this code but not solve problem.
please help me about this
            Button b = new Button();
            b.Text = e.KeyChar.ToString();
            if (panel1.Enabled)
            {
                if (e.KeyCode == Keys.Return)
                    btnequal_Click(null, null);
                 if (e.KeyChar >= '0' && e.KeyChar <= '9')
                 {
                     Numbers(b, null);
                     foreach (Button c in panel1.Controls)
                     {
                         if (c.Text == b.Text)
                         {
                             c.Focus();

                         }
                     }

                 }
                 else
                     if (e.KeyChar == '+' || e.KeyChar == '-' || e.KeyChar == '/' || e.KeyChar == '*')
                     {
                         Operations(b, null);
                         foreach (Button c in panel1.Controls)
                         {
                             if (c.Text == b.Text)
                             {
                                 c.Focus();

                             }
                         }
                     }
                     else
                         if (e.KeyChar == '.')
                         {
                             btndot_Click(null, null);
                             btndot.Focus();
                         }
                         else
                             if (e.KeyChar == '\b')
                             {
                                 btnbackspace_Click(b, null);
                                 btnbackspace.Focus();
                             }
            }

Answers (2)