Hey guys, after the tutorial shows how to take text from a text field and display it in a text block when the user clicks a button. Simple enough ... but I want to do this instead of pressing a button that adds the text that I want the enter button to do this.
Searching here, I found the following code, but it does nothing.
private void textBox_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
listBox.Items.Add(textBox.Text);
}
}
So, a text box with a string is called a text box, and I want the text from this text box to be added to my list (listBox). When I press the enter button, it does nothing. Any help?
Thank!