1) your browser security must be set to low
2) Full Trust attribute should be set to true, in your page (C#).
2) Call your Barcode Scanner API functions from JavaScript, set the result to textbox.
the link my help you for how to call API function from javascript.
http://wiki.developer.myspace.com/index.php?title=Introductory_Applications[
^
mark as answer if helps you a little...