Adding to what OriginalGriff wrote in his solution:
Reading barcodes from a textbox has the disadvantage that you have to ensure that the textbox always has the input focus.
There are two alternatives that I know of:
Depending on the manufacturer and type of barcode scanner there can be a manufacturer-provided SDK which could be used to receive the scanned barcodes via some kind of "dedicated" event in your application. I only know this from reading about it, I can't tell for which manufacturers and types of barcode scanners this would be an option; you would have to ask the manufacturers or distributors.
The other alternative is a generic one which should work for any barcode scanner with keyboard emulation. It works by reading the raw keyboard input (which is normally abstracted away by the CLR), which allows to identify the individual device from which key events where sent; even without a textbox. By enumerating the keyboard-devices before and after connecting a barcode scanner with keyboard emulation you can figure out the device-ID of the barcode scanner and then let your application filter out its key events and process them as a scanned barcode. This Codeproject-article presents a way to do this:
Using Raw Input from C# to handle multiple keyboards[
^]