Asked by r. Answered by the Wonk on December 2, 2002
A.
You can’t make it quite automatic, but if you can catch the event when barcode data is available, you set the control to have focus in your code using the ActiveControl property of the Form class:
class BarcodeForm : Form {
...
void barCode1_DataAvailable(object sender, EventArgs e) {
// Check that active control is a TextBox
TextBox textBox = this.ActiveControl as TextBox;
if( textBox == null ) return;
// Get data from the barcode reader
textBox.Text = GetBarcodeData();
// Set the next active control
if( textBox == textBox1 ) this.ActiveControl = textBox2;
}
}