Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I can't seem to find the SelectedIndexChanging event on Windows form control Check Listbox. Is there any way to get the event before the selectedIndexChanged or tell what the previous selected index was?

Thanks
Posted
Comments
Sunasara Imdadhusen 16-Sep-10 7:23am    
I check box list there is no events SelectedIndexChanging. because you can select multiple items by clicking on checkbox to checked.
do you want to get previously checked items whenever you checked/unchecked any items from check box list?

Well what I have is a list of certificates stored in a check list box, for each certificate the user can select a specific Start or End Date. Now when the user leaves that specifc text box I would like to check if it has been checked and then save that certificate and Start/End date. If that makes sence.

Maybe I should just pop a new windows which promps the user for a Start and End Date?
 
Share this answer
 
Hi Bardy,

Please you can use following code:

C#
private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            if (e.NewValue == CheckState.Checked)
            {
                //You can save the selected item into databse
                //Yor Popup should comes here...
                MessageBox.Show("Selected item is: " + checkedListBox1.Text);
            }
            else
            {
                //you can remove the item from database
            }
        }


Please do let me know, if you have any doubt.

Please provide Vote if this would be helpful to you.

Thanks,
Imdadhusen
 
Share this answer
 
Comments
Bardy85 16-Sep-10 8:08am    
Hi Sunasara,

Yeah thats kind of what I did, but instead of just showing the selected Items text, I created a new form so that the user can fill in the start and End Date for the specified certificate.
Thanks anyway.
Sunasara Imdadhusen 16-Sep-10 8:13am    
Yes you are absolutely right. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900