Song Lee

Song Lee

  • NA
  • 47
  • 38.4k

Displaying user input into listbox

Nov 23 2014 8:53 PM
 Hello,
I am making a winform application that retrieves data from user with text box, and display on listBox. 
Below is the ones I tried, but no error, and it's not working. 
Help please! :) 
 
private void Button_Click(object sender, EventArgs e)
{
          current.name = nameTextBox.Text.Trim();
          current. description = descriptionTextBox.Text.Trim(); 
 
          listBox.BeginUpdate();
          listBox.Items.Clear();
          string row = String.Format ("{0} {1}", current.name, current description);
          //listBox.Items.Add("{0} {1}", current.name, current description); //Another method I tried, but didn't work.
          listBox.EndUpdate(); 
 
}
 

Answers (2)