SEARCH C# PROGRAMMING CODES HERE

How to divide value in c# visual studio.

Divide value in c# visual studio
Step - Add three textbox and one button from the toolbox and then go to the button1 click event and copy the following code.

private void button1_Click(object sender, EventArgs e)
        {
            int divident = 0;
            int divider = 0;
            int result = 0;

            if (int.TryParse(textBox1.Text, out divident) & int.TryParse(textBox2.Text, out divider))

            {
              result = divident/divider;
                textBox3.Text = result.ToString();
            }
        }

No comments:

Post a Comment