I will if i press down that the focus go to the next textfield.

i will not do every time

if (focus() = controlname)
 controlname.focus()
else if  (focus() = controlname)
 controlname.focus()

what can i do?

Hi tchiloh! Welcome at Daniweb.
Did you know that every textbox has a TabIndex property you can set?
So you can tab on the textbox that has the focus and you will automatically move to the one with the higher tabindex.
You even don't have to install all those indexes manually.
Select your Form. In the View menu you will find an item Tab Order.

Hi tchiloh! Welcome at Daniweb.
Did you know that every textbox has a TabIndex property you can set?
So you can tab on the textbox that has the focus and you will automatically move to the one with the higher tabindex.
You even don't have to install all those indexes manually.
Select your Form. In the View menu you will find an item Tab Order.

i know that are a tabindex. but i'm making a application for a PDA.
The PDA hasn't a tab key. So i will if i press down, that the focus go to the next field.

So what is your question exactly? Are you trying to get the code to advance controls with the tab key like a form does, but without having to actually press the key?

So what is your question exactly? Are you trying to get the code to advance controls with the tab key like a form does, but without having to actually press the key?

i will if i press down, that my app send a "tab" key.

somthing like this:

private void keyDown(object sender, KeyEventArgs e)
{
    if (e.KeyData == Keys.Down)
        SendKeys.Send("{TAB}");
}

but i can't make a app.config to enable SendKeys.
i work with compact framework and compact framework doesn't support app.config.

is there another way?

Edited 6 Years Ago by tchiloh: n/a

You still haven't answered my question. I don't understand what you are trying to do. Are you trying to focus the next control like when the tab key is being pressed?

//
    // Summary:
    //     Retrieves the next control forward or back in the tab order of child controls.
    //
    // Parameters:
    //   ctl:
    //     The System.Windows.Forms.Control to start the search with.
    //
    //   forward:
    //     true to search forward in the tab order; false to search backward.
    //
    // Returns:
    //     The next System.Windows.Forms.Control in the tab order.
    public Control GetNextControl(Control ctl, bool forward);

Why not just use Control.GetNextControl() ?

Edited 6 Years Ago by sknake: n/a

You still haven't answered my question. I don't understand what you are trying to do. Are you trying to focus the next control like when the tab key is being pressed?

//
    // Summary:
    //     Retrieves the next control forward or back in the tab order of child controls.
    //
    // Parameters:
    //   ctl:
    //     The System.Windows.Forms.Control to start the search with.
    //
    //   forward:
    //     true to search forward in the tab order; false to search backward.
    //
    // Returns:
    //     The next System.Windows.Forms.Control in the tab order.
    public Control GetNextControl(Control ctl, bool forward);

Why not just use Control.GetNextControl() ?

yes, when i click down, i will focus on the next textfield.
i can't do getnextcontrol. i have tryed with SelectNextControl but he doing that 1 time.
i have this: this.SelectNextControl(tb_scan,true,false,true,true);

i resolved the problem to add to form.designer.cs activeControl.

compact framework missing a lot.

now i have: this.SelectNextControl(this.ActiveControl,true,true,false,false);

Edited 6 Years Ago by tchiloh: n/a

This question has already been answered. Start a new discussion instead.