A barcode scanner will typically send input as if manually entered from keyboard and your only chance to detect that is having a special first character sent by the barcode scanner. I know some barcode scanners do support that and thus you have a hotkey before the next 12 or so keys come in as the barcdode.
Make use of that and in the forms keypress event wait for such a hotkey, then set focus to the textbox that should get the barcode.
To prevent manual input - which may not be needed in case of the barcodes - set the textbox to readonly. But then also the "keystrokes" from the barcodescanner will not be entered into the textbox. Perhaps use the form's keypress again to detect the barcode digits and forward them to the textbox.value porerty, which you still can set programmatically, if the textbox.readonly is .T.
For the scales about the same recommendations, I know scales typically send in their input via COM port or perhaps also via some socket, for which you' need the winsock ActiveX. But if your electronic scales simply send keystrokes too, well, there needs to be another present key before each weight coming in from a scale to detect that it comes from a scale.
Bye, Olaf.