none
when i press right or left key on combobox i need to go to another control RRS feed

  • Question

  • hi

    when i press the right or left key on comboBox i open the list

    and i need to go to another control.

    how to do it ?

    thanks

    Wednesday, July 31, 2013 8:38 AM

Answers

  • Hey E_gold,

    first of all you should map your tab index for each control that you want to be able to go left or right.

    For each textbox you must move add this keypress event, don't forget tabstop = true properties.

    private void tb_keypress(...)

    { int temporary

    if(Keys.Left == key)

    {

    temporary = ((textbox)sender).tabindex - 1;

    }

    else if(Keys.left == key)

    {

    temporary = ((textbox)sender).tabindex + 1;

    }

    //focus the one with the correct tabindex;

    //...

    }


    Exemple:

    textbox A (tabindex=1),    textbox B (tabindex=2)    ,  textbox C (tabindex=3)     ,  textbox D (Tabindex=3)

    If you are at B and press to left, you will go to index 1, so you move left. If you press right twice, you will

    go to textbox C, etc. you can even add multiple lines of textbox. Sorry for the not completed code, i'm not at home or works so i cant try the code.

    Hope it helps.

    Have a nice day!



    • Edited by Mr.Alexz Wednesday, July 31, 2013 1:18 PM Correction code block
    • Marked as answer by Eileen niModerator Wednesday, August 7, 2013 4:58 AM
    Wednesday, July 31, 2013 1:17 PM