0

I am coding a program and have this function where i need to delete a record. The current code i have at the moment deletes a record but only deletes the top record but i need it to delete the record the user has selected.

This is the current code:

DailyRoflGamingDatabaseDataSet1.Player.Rows(0).Delete()

Can anyone help me?

3
Contributors
7
Replies
8
Views
8 Years
Discussion Span
Last Post by __avd
0

Welcome Tini791.

Your code show that you are deleting 1st record from the dataset and not from the listbox.

Please clarify it.

0

This should work where listbox1 is the name of your list box.

lstbox1.Items.Remove(listbox1.SelectedItem)
0

It deletes from both but i want it to delete the selected record and not the top record

0

This should work where listbox1 is the name of your list box.

lstbox1.Items.Remove(listbox1.SelectedItem)

I tried this code and when i tried runningit, it crashed when i tried using the function with this code :(

0

this was the original code:

DailyRoflGamingDatabaseDataSet1.Player.Rows(0).Delete()

then i tried it with that suggested code:

RemovePlayerListBox.Items.Remove(RemovePlayerListBox.SelectedItem)

when i tried this code it crashed my program

0

b89smith> Post your code.

Post your complete code so he/she can decide what you can do with your code?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.