Mark Fenech

Mark Fenech

  • NA
  • 82
  • 68k

Deleting An item from a List Box from a Database

Apr 24 2011 10:19 AM
Hi Im trying to delete an item from the listbox which the user selects here you can find my code and a screenshot tnx.

Code:

   public void deleteEvent(ListBox list_event)
        {
            int i = list_event.SelectedIndex;

            ds.Tables["tblEvents"].Rows[i].Delete();
            da.Update(ds.Tables["tblEvents"]);
        }

Im getting Object reference not set to an instance of an object Exception.

ScreenShot: http://i53.tinypic.com/ad1209.jpg

Answers (11)