SelectedIndexChanged вызывает дважды во время отладки, но только один раз, когда я запускаю его напрямую - C# [закрыто]C#

Место общения программистов C#
Ответить
Anonymous
 SelectedIndexChanged вызывает дважды во время отладки, но только один раз, когда я запускаю его напрямую - C# [закрыто]

Сообщение Anonymous »


I have a ComboBox with the SelectedIndexChanged Event Handler that is firing twice back-to-back while I'm debugging it and other events/functions, but when I run it without debugging, it only fires once (which is what it's supposed to do). Other than the processing waste, I wouldn't mind, but I'm actually triggering the Event directly, otherwise it doesn't call at all when I run it and once when I debug.

The steps go like this: I have a couple KeyEvents monitoring when I press Shift+Enter. When I do, it adds ComboBox.Text to ComboBox.Items and sets ComboBox.DroppedDown to true.

if (e.KeyCode == Keys.Enter) if (ShiftPressed)//This is falsified in KeyUp. { IngredientEnter.Items.Add(IngredientEnter.Text); IngredientEnter.DroppedDown = true; //I manually call the handler because it would call when I would debug, but not when I would just run it. IngredientEnter_SelectedIndexChanged(sender, EventArgs.Empty); } Again, when I'm debugging, SelectedIndexChanged is triggered; when I'm running w/o debugging, it doesn't.

I sincerely apologize if this is a dup, but I looked forever and even created an account just to ask. Edit: Sorry, for the lack of code, hopefully this helps.


Источник: https://stackoverflow.com/questions/780 ... n-i-run-it
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C#»