I have a problem with a barcode Scanner. It is connected via Bluetooth to my laptop, and it is working and being recognized for the system as a Keyboard Wedge. For example, if I open a NotePad document, I can see how the barcodes are writed inmediatelly to it.
However, I need to read that input data in a Windows Form . NET application, in Visual Studio 2008 and C# code.
Although I have tried to keep focus on the TextBox where I want to write the input, there is no way for me to receive in this program what the scanner reads. Moreover, even in the source code, if I do focus on it so you can write, the barcode Scanner does not writes what it reads neither, although it can do it in NotePad documents, as I said.
This is my code sample:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
cajaCodigo.Focus();
}
private void cajaCodigo_TextChanged(object sender, EventArgs e)
{
string codigo = cajaCodigo.Text;
if (codigo.Length > 1)
{
label2.Visible = true;
}
}
void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
string codigo = cajaCodigo.Text;
if (codigo.Length > 1)
{
label2.Visible = true;
}
}
}