Delete button, 3 tables and a list box

athrun5

New member
Joined
Jun 18, 2014
Messages
1
Programming Experience
Beginner
I am trying to make a Delete button for my project and I have 3 tables with its own button that fills up the list box. What I need to do is make a Delete button that can delete the Full name from the list box and Delete the entry from the database. I am having a bit of trouble going forward with this as I am still a beginner, so if someone could lead me in the right direction or at least give me some ideas or hints on how I may pull this off that would be much appreciated. I have my current work in the post at the bottom.
<attachment removed by moderator>.
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,272
Location
Sydney, Australia
Programming Experience
10+
Generally speaking, attaching an entire project should be a last resort. It's a pain for us to download the archive, extract it, open the project and then wade through it to find the relevant part. It's generally more useful for you to post just the relevant code directly and, if needed, screenshots that illustrate the issue. Also, if you do attach a project, make sure that you delete the bin and obj folders first because you are not allowed to attach binary files.

As for the issue, the process is fairly simple:

1. Call Fill on a data adapter or table adapter to populate a DataTable.
2. Bind the DataTable to a BindingSource.
3. Bind the BindingSource to the ListBox.
4. To delete the selected record from the DataTable, call RemoveCurrent on the BindingSource.
5. To save the changes in the DataTable (add, edit and delete) back to the database, call Update on the same data adapter or table adapter.
 
Top Bottom