Question: In C# I need comments, description of what the program does or how to use it. Also need documentation to show the program works in
In C#
I need comments, description of what the program does or how to use it. Also need documentation to show the program works in form of table.
Thanks, let me know if any question
namespace Calc { public partial class Form1 : Form { int number1; int number2; bool check1; bool check2; string text1; string text2;
public Form1() { InitializeComponent(); }
private void add_btn_Click(object sender, EventArgs e) { text1 = num1.Text; check1 = int.TryParse(text1, out number1); text2 = num2.Text; check2 = int.TryParse(text2, out number2);
if(check1 == false || check2 == false || (number1 < 0 || number2 < 0)) { result.Visible = true; result.ForeColor = Color.Red; result.Text = "Value must be numeric and > 0"; } else { int res = number1+ number2; result.Visible = true; result.ForeColor = Color.Purple; result.Text = res.ToString(); }
} private void multiply_btn_Click(object sender, EventArgs e) { text1 = num1.Text; check1 = int.TryParse(text1, out number1); text2 = num2.Text; check2 = int.TryParse(text2, out number2);
if(check1 == false || check2 == false || (number1 < 0 || number2 < 0)) { result.Visible = true; result.ForeColor = Color.Red; result.Text = "Value must be numeric and > 0"; } else { int res = number1 * number2; result.Visible = true; result.ForeColor = Color.Purple; result.Text = res.ToString(); } }
private void reset_btn_Click(object sender, EventArgs e) { result.Visible = false; num1.Text = ""; num2.Text = ""; } } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
