hey there
i'm new in programing and there is a lot of hard things on me
:(
i want to make a program that take a value of text box and add it to the list box and one button to delete the selected item
i make that and this is my code
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles adbut.Click
ListBox1.Items.Add(TextBox1.Text)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles delbut.Click
ListBox1.SelectedItem.Clear()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
the problem that if the user didn't select an item and press the delete button the program will crush how can i make the button disable until user select item ?
i try this code but there is error :
If ListBox1.SelectedItem = True Then delbut.Enabled = True
else
delbut.Enabled = False
ListBox1.SelectedItem.Clear()
end if
can you plz help ari ??