Hi all,
Im building my first small program in Visual C# 2005 express, you enter your name in a text box and press the ok button and it changes the value of a label so it shows "hello <name entered>", its all working fine, but i would like it to change the name of the labels when you press return in the text box but im not sure how to do it, any advise would be apreciated, thanks
Nez
namespace WindowsApplication1
{
public partial class Form1 : Form
{
string name;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
label2.Text = "Hello";
label3.Text = name;
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
name = textBox1.Text;
}
}
} n.b This is what i have so far, i tried using an if statement, but i couldnt quite get it right, im sure there must be some simple line or two i can put in the textbox1 section.