Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Control one item check in CheckedListBox
WhatsApp
Venkatesan Jayakantham
12y
15.9
k
0
0
25
Blog
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
Up Next
Unique Array Items In C#
Ebook Download
View all
FileInfo in C#
Read by 16.6k people
Download Now!
Learn
View all
Membership not found