Getting and setting the focused control

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 ...
 
A

Alex Yakhnin [eMVP]

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

int ind = Form1.Controls.IndexOf(txtName);
 
M

Martin Robins

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top