TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Thomas Morrison
NA
10
19.4k
Bind listbox selected item focus to button enabled
Sep 11 2010 11:14 AM
Hi, I have a listbox which I want the users to be able to remove items from when they select an item then click the delete button. However an error will occur if you try to click remove when having nothing in the list box selected.
lstToSearch.Items.RemoveAt(lstToSearch.SelectedIndex);
Now in the "olden days" I would have to into events such as SelectionChange and have btnRemove.Enabled = True, but I'm sure there must be a more elegant way with data bindings? Am I right?
So to recap, when the user selects an item on the listbox, the remove button becomes enabled. When no item is selected the remove button is disabled
Thanks
Thomas
Reply
Answers (
2
)
Invalid buffer size for BCP column property
XML bombs out when can't locate element