This code will take the selected item and put the string of the item into an inputbox and then you can edit the item inside of the inputbox. However, if you delete everything in the edit inputbox then it makes the item Nothing and it is just a blank space in my listbox.
How would I make it so that if the user deletes everything in the inputbox then it will not change anything since i dont want blank spaces in the listbox.
Sorry if you don't understand the question.
How would I make it so that if the user deletes everything in the inputbox then it will not change anything since i dont want blank spaces in the listbox.
Sorry if you don't understand the question.
Code:
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
If ListBox1.SelectedItem <> Nothing Then
Dim output As String = ""
output = InputBox("Type a new message in the text box below.", "Edit Message", ListBox1.SelectedItem.ToString, -1, -1)
ListBox1.Items(ListBox1.SelectedIndex) = output
Else
MessageBox.Show("You haven't selected a message.", Nothing, Nothing, MessageBoxIcon.Error)
End If
End Sub