First of all lets say that i am new to C#...
I am using WinForms: I have tried using this code to change the value of the ComboBox with a shortcut. I have also tried using SelectedValue instead of SelectedIndex. Afterwards I tried to focus the ComboBox before or after it changes value. Finally i tried converting this to a stwitch statement, but every time i execute it nothing happens.
I am using Visual Studio 2017 - when i tried to debug it, the debugger showed me that after it executes the code inside the if statement it goes inside the else statement and executes the code there again...
private void Form_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control && e.KeyCode == Keys.E)
{
//CBoxLimit.Focus();
if (CBoxLimit.SelectedIndex == 0)
{
CBoxLimit.SelectedIndex = 1;
}
else
{
CBoxLimit.SelectedIndex = 0;
}
//CBoxLimit.Focus();
}
}
Thanks in advance for your help...