I have a messagebox that asks if I want to delete a specific ebook from my listbox.
The message says, "“Do you want to remove the x eBook?” the x needs to be the title of the book selected.
This is what I have:
Each line in the textbox has Title, Author, and Price
So, my x is showing Title, Author, and Price.
Examples:
Textbox shows:
Allegiant Veronica Roth 3.99
Divergent Veronica Roth 2.99
My message is showing:
Do you want to remove the Allegiant Veronica Roth 3.99 eBook?
What I want is: Do you want to remove the Allegiant eBook?
Please, any suggestions?
Thanks
The message says, "“Do you want to remove the x eBook?” the x needs to be the title of the book selected.
This is what I have:
Code:
Private Sub btnRemove_Click(sender As Object, e As EventArgs) Handles btnRemove.Click ' removes the selected line from the list box Dim x As String = lstEbooks.Text() If MessageBox.Show(“Do you want to remove the " & x & " eBook?”, "eBooks", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1) = DialogResult.Yes Then ' if a line is selected, remove the line If lstEbooks.SelectedIndex <> -1 Then lstEbooks.Items.RemoveAt(lstEbooks.SelectedIndex) End If End If End Sub
So, my x is showing Title, Author, and Price.
Examples:
Textbox shows:
Allegiant Veronica Roth 3.99
Divergent Veronica Roth 2.99
My message is showing:
Do you want to remove the Allegiant Veronica Roth 3.99 eBook?
What I want is: Do you want to remove the Allegiant eBook?
Please, any suggestions?
Thanks