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
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Control one item check in CheckedListBox
Venkatesan Jayakantham
May 03, 2012
15.8
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
Control one item check in CheckedListBox.
Here is a small code snippet for maintaining the checkedlist box control with only one checks.
Problem:
I want to maintain only one checks in my checked list box in windows forms. But checked list box holds the property of allowing multiple checks. How can I control ,one item check in checked list box in c#
Solution:
private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e)
{
CheckedListBox.CheckedIndexCollection checkedIndices = checkedListBox1.CheckedIndices;
if (checkedIndices.Count > 0 && checkedIndices[0] != e.Index)
{
checkedListBox1.SetItemChecked(checkedIndices[0], false);
}
}
Cheers,
Venkatesan Prabu .J
Head, KaaShiv InfoTech.
http://www.kaashivinfotech.com/
Control one item check in CheckedListBox
Next Recommended Reading
Unique Array Items In C#