Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
2
Reply
Bind listbox selected item focus to button enabled
Thomas Morrison
Sep 11 2010 11:14 AM
7.7k
Reply
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
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
unable to access the server.mappath() methode what is the wrong here
XML bombs out when can't locate element