11
Answers

Deleting An item from a List Box from a Database

Mark Fenech

Mark Fenech

13y
1.7k
1
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)