Click here to Skip to main content
15,914,221 members
Home / Discussions / C#
   

C#

 
GeneralRe: ComboBox selection generating list for another comboBox question [modified] Pin
Henry Minute18-May-10 8:40
Henry Minute18-May-10 8:40 
GeneralRe: ComboBox selection generating list for another comboBox question Pin
mprice21418-May-10 10:43
mprice21418-May-10 10:43 
GeneralRe: ComboBox selection generating list for another comboBox question Pin
Henry Minute18-May-10 11:43
Henry Minute18-May-10 11:43 
GeneralRe: ComboBox selection generating list for another comboBox question Pin
mprice21418-May-10 12:10
mprice21418-May-10 12:10 
GeneralRe: ComboBox selection generating list for another comboBox question Pin
mprice21418-May-10 17:29
mprice21418-May-10 17:29 
GeneralRe: ComboBox selection generating list for another comboBox question Pin
Henry Minute19-May-10 1:15
Henry Minute19-May-10 1:15 
GeneralRe: ComboBox selection generating list for another comboBox question Pin
mprice21419-May-10 3:49
mprice21419-May-10 3:49 
GeneralRe: ComboBox selection generating list for another comboBox question [modified] Pin
Henry Minute19-May-10 4:22
Henry Minute19-May-10 4:22 
mprice214 wrote:
Since DataGridViewEditingControlShowingEventArgs is handling the EditingControlShowing event and will be passing the arguments to the SelectedIndexChanged event handle


I think that you have slightly misunderstood what is happening here. The EditingControlShowing handler does not pass any arguments, it simply tells the ComboBox where to find the code to execute when its SelectedIndex changes and regardless of whatever else is going on it will fire off that code when the index does change. Of course it may not execute it instantly, not even modern computers can really do more than one thing at a time.

It has just occurred to me that you are actually asking about the '-=' and '+=' bits. They are like that because the SelectedIndexChanged contains a list of methods that it should execute. If we used the '+=' line only, then each time we did so another instance of the column1DataGridViewComboBox_SelectedIndexChanged would be added to the list meaning that it would execute once after the first time, twice after the second, three times...... You get the idea. So we first '-=' it to remove the handler from the list, before adding it again. Of course we could test to see if it was there already NOTE** this is not real code
if (!cb.SelectedIndexChanged.List.Contains(column1DataGridViewComboBox_SelectedIndexChanged))
{
 cb.SelectedIndexChanged += column1DataGridViewComboBox_SelectedIndexChanged;
}
oops forgot to close the tag.

but the '-=' then '+=' method is quicker.

Hope that this helps. Smile | :)
Henry Minute

Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
Why do programmers often confuse Halloween and Christmas?
Because 31 Oct = 25 Dec.
modified on Wednesday, May 19, 2010 10:31 AM

GeneralRe: ComboBox selection generating list for another comboBox question Pin
mprice21419-May-10 4:43
mprice21419-May-10 4:43 
GeneralRe: ComboBox selection generating list for another comboBox question Pin
Henry Minute19-May-10 5:07
Henry Minute19-May-10 5:07 
GeneralRe: ComboBox selection generating list for another comboBox question Pin
mprice21419-May-10 5:29
mprice21419-May-10 5:29 
GeneralRe: ComboBox selection generating list for another comboBox question Pin
mprice21419-May-10 18:46
mprice21419-May-10 18:46 
GeneralRe: ComboBox selection generating list for another comboBox question Pin
Henry Minute20-May-10 1:35
Henry Minute20-May-10 1:35 
GeneralRe: ComboBox selection generating list for another comboBox question [modified] Pin
mprice21420-May-10 3:44
mprice21420-May-10 3:44 
GeneralRe: ComboBox selection generating list for another comboBox question Pin
Henry Minute20-May-10 5:23
Henry Minute20-May-10 5:23 
GeneralRe: ComboBox selection generating list for another comboBox question Pin
mprice21426-May-10 19:10
mprice21426-May-10 19:10 
AnswerRe: ComboBox selection generating list for another comboBox question Pin
William Winner18-May-10 7:31
William Winner18-May-10 7:31 
GeneralRe: ComboBox selection generating list for another comboBox question Pin
mprice21418-May-10 7:58
mprice21418-May-10 7:58 
GeneralRe: ComboBox selection generating list for another comboBox question Pin
William Winner18-May-10 11:12
William Winner18-May-10 11:12 
GeneralRe: ComboBox selection generating list for another comboBox question Pin
mprice21418-May-10 12:16
mprice21418-May-10 12:16 
QuestionRemoting Service Pin
Britt Mills18-May-10 4:21
Britt Mills18-May-10 4:21 
AnswerRe: Remoting Service Pin
canangirgin18-May-10 4:48
canangirgin18-May-10 4:48 
GeneralRe: Remoting Service Pin
Britt Mills18-May-10 4:56
Britt Mills18-May-10 4:56 
GeneralRe: Remoting Service Pin
canangirgin20-May-10 21:20
canangirgin20-May-10 21:20 
QuestionIE Page size Pin
dSolariuM18-May-10 3:21
dSolariuM18-May-10 3:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.