CheckedListbox Question

  • Thread starter Thread starter Moondog
  • Start date Start date
M

Moondog

Simple question:

How can I test if an item has been checked in a CheckedListBox?

My scenario is if a user clicks on my CheckedListBox, and the item has
not been checked yet, do some event, if it has already been checked,
do something else.

Thanks,
Dominic Isaia
(e-mail address removed)
 
Moondog said:
Simple question:

How can I test if an item has been checked in a CheckedListBox?

My scenario is if a user clicks on my CheckedListBox, and the item has
not been checked yet, do some event, if it has already been checked,
do something else.


Simple answer: You'll have to save the state of the checkbox so you can
tell what it was before the event was called.

LFS
 
Simple answer: You'll have to save the state of the checkbox so you can
tell what it was before the event was called.

Hi Larry,

This info is already provided by the .itemcheck event args of the
checkedlistbox.

Private Sub CLB1_ItemCheck(ByVal sender As Object, ByVal e As
System.Windows.Forms.ItemCheckEventArgs) Handles CLB1.ItemCheck

msgbox (e.CurrentValue)
msgbox (e.NewValue)

End Sub

e.newvalue is read/write, so you could for instance cancel the check change
with e.NewValue = e.CurrentValue.

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top