Solved

Visual Basic 2005 CheckedListBox control question

Posted on 2010-09-04
1
550 Views
Last Modified: 2013-12-20
The below code is In the Click sub of a CheckedListBox, the code checks and unchecks a single row inside a checkedListBox with a single click.  EXCEPT FOR if the end user clicks and then re clicks on the same row.  The control will not respond to the 2nd single click without clicking on another row inbetween single clicks.  The name of the control is ChkProviders.  There appears to be some sort of refresh needed inbetween each change?

        Dim chkstate As CheckState
        chkstate = ChkProviders.GetItemCheckState(ChkProviders.SelectedIndex)
        If chkstate = CheckState.Checked Then
            ChkProviders.SetItemCheckState(ChkProviders.SelectedIndex, CheckState.Unchecked)
        Else
            ChkProviders.SetItemCheckState(ChkProviders.SelectedIndex, CheckState.Checked)
        End If
 
0
Comment
Question by:dastaub
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 500 total points
ID: 33605998
You can have the same functionality by setting the CheckOnClick property of the CheckedListBox to True.

Wayne
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question