You may use the
Validated
event of the textbox instead. And Richard is right, you should populate the listbox with the text from the textbox, not the other way around. Moreover, there is no point in using the
Text
property on a listbox, since by essence it is meant to display a list of items. Better add to its
Items
collection instead.
private void tb_vonalkod_Validated(object sender, EventArgs e)
{
ListBox1.Items.Add(TextBox1.Text);
}