Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Listbox SelectedIndexChanged not firing
 

Listbox SelectedIndexChanged not firing

i have 2 toolstrips . in the first one Ihave list box , in the second I have datagridview.
the listbox have SelectedIndexChanged event and the datagrid have cellValidatind event.

my probleam is :

when the user is in edit mode in the grid and then go to the listbox and select one of the list , i expect it to be: cellValidatind(of the datagridview) and then SelectedIndexChanged (of the list box).
but no!!!!! the cellValidatind is fire and insideI make change on the grid and then the SelectedIndexChanged dont fire !!!!

I try to doMouseClick event of the list box and of the form - non of the, fire. the only thing that make it to fire is
in listBox_Enter to do :

this

.SendClick(Cursor.Position);

this.SendClick(Cursor.Position);

but it make my a lot of trouble .
like when I inter the list box in TabIndex it send click for wher tje user stand and it make alot of trouble.

what can i do?????????????????????????????????????????????????????????


Nissim Trabelsy
Nissim Trabelsy  Sunday, September 06, 2009 10:55 AM

Hi,

The datagridview validating event occurs leaving the cell. So you will not get the listbox.SelectedIndexChanged event before validating event when you table out the datagridview control.

I guess you may want to set the dataGridViewCell value to the selected items of listbox.

You can showdialog a form and the form has a listbox. You can handle the listbox selectedIndexChanged event to set the value. You can call datagridview.validating() method to check the value.

You can also try the DataGridViewComboBoxColumn control. It also show the drop down list when user edit the cell.

Best regards,

Ling Wang


Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Ling Wang  Sunday, September 13, 2009 10:46 AM
important::::::
in the cellValidatind I have messegebox I think that because the user click on the massage box the event of the listboxclick isnt fire .I most have this messagebox....
Nissim Trabelsy
Nissim Trabelsy  Sunday, September 06, 2009 12:26 PM

Hi,

The datagridview validating event occurs leaving the cell. So you will not get the listbox.SelectedIndexChanged event before validating event when you table out the datagridview control.

I guess you may want to set the dataGridViewCell value to the selected items of listbox.

You can showdialog a form and the form has a listbox. You can handle the listbox selectedIndexChanged event to set the value. You can call datagridview.validating() method to check the value.

You can also try the DataGridViewComboBoxColumn control. It also show the drop down list when user edit the cell.

Best regards,

Ling Wang


Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Ling Wang  Sunday, September 13, 2009 10:46 AM

You can use google to search for other answers

Custom Search

More Threads

• Themes & Skins?
• Form Localization Issues Exception
• UserControls won't show in Toolbox
• how to NOT go to the designer
• who do i capture events from a user control
• Enforcing Windows XP Silver Theme in application
• Textbox border colour
• tag is missing
• MessageBox problems
• Text align