Getting and setting the focused control

  • Thread starter Thread starter Martin Robins
  • Start date Start date
M

Martin Robins

I have a CF Forms application that utilises a barcode scanner. I am trying
to automate the use of the scanner and the focus of controls as data is
captured, however the CF is mising the Form.ActiveControl property and the
Form.SelectNextControl() method.

Has anybody found a work around for this? I can easily replicate the
Form.ActiveControl property by handling Control.GotFocus events, but I
cannot easily identify a means of selecting the next control on the form
without hard coding a route.

Suggestions please ...
 
You can try to use the order of the controls Form.Controls
collection:

int ind = Form1.Controls.IndexOf(txtName);
 
Thanks Alex, but this is not enough. You see, if the next control in the
collection is a label for example, it cannot focus.

I have created a management class now that handles setting control focus in
the correct order.

Cheers.
 
Back
Top