An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
Thank you for reaching out.
You can solve this using a button click.
User should:
- Enter two numbers in TextBox1 and TextBox2
- Click the button
The program will then:
- Check if both numbers are greater than 100
- Show True/False
- Show sum only if allowed
Use this code in the button click:You can solve this using a button click.
private void button1_Click(object sender, EventArgs e)
{
int num1, num2;
if (int.TryParse(textBox1.Text, out num1) &&
int.TryParse(textBox2.Text, out num2))
{
bool result = (num1 > 100 && num2 > 100);
textBox3.Text = result.ToString(); // show True/False
if (result)
label2.Text = (num1 + num2).ToString();
else
label2.Text = "Not allowed";
}
}
Important points:
- Do not type True/False manually
- Click the button to get the result
- TextBox3 will show True/False automatically
- You can set TextBox3 →
ReadOnly = truein Properties
Reference:
Create WinForms app
Please let us know if you require any further assistance, we’re happy to help. If you found this information useful, kindly mark this as "Accept Answer". So that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.