I have a list view control on one of my forms in my program.
If i click on a selected item and click on the delete button it gets removed. But i want it so that if i havent got an item selected i click on delete i get a message box telling the user to select an item to delete. i cant seem to get that to happen.
What code would i need?
thanks
tukky
0
Light Poster
Recommended Answers
Jump to PostTry putting this in your button click event:
If ListBox1.SelectedIndex = -1 Then MsgBox("Please select an object to delete.") Else ListBox1.Items.RemoveAt(ListBox1.SelectedIndex) End If
Jump to PostSorry, I misread.
All 6 Replies
crazyhorse09
9
Junior Poster in Training
tukky
0
Light Poster
crazyhorse09
9
Junior Poster in Training
tukky
0
Light Poster
pritesh2010
30
Posting Whiz in Training
auxius
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.