srikanthreddy

srikanthreddy

  • NA
  • 28
  • 23.4k

working with listbox and textboxs

Feb 9 2012 8:28 AM

while edit/update error in this application...
my question is i am selecting one item from the listbox ..that is filled with 3 textboxs and modified some content and click on edit button ...

the error is "object reference not set to an instance of object".......
 listBox1.Items.Add(textBox1.Text + "," + textBox2.Text + "," + textBox3.Text);
string s = listBox1.SelectedItem.ToString();
           i = listBox1.SelectedIndex;
           string[] s1 = s.Split(',');
           textBox1.Text = s1[0].ToString();
           textBox2.Text = s1[1].ToString();
           textBox3.Text = s1[2].ToString();


Answers (1)