learning C#
having trouble with a simple code asking for name and age and the app should output it but doesnt seem to be working any help is greatly appreciated
namespace collectNameAgeApp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string name = textBox1.Text;
int age;
if (int.TryParse(textBox2.Text, out age))
{
label3.Text = $"Hello {name}, you are {age} years old.";
}
else
{
label3.Text = "Please enter a valid age.";
}
}
}
}
namespace collectNameAgeApp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string name = textBox1.Text;
int age;
if (int.TryParse(textBox2.Text, out age))
{
label3.Text = $"Hello {name}, you are {age} years old.";
}
else
{
label3.Text = "Please enter a valid age.";
}
}
}
}