Keyboard Wedge only writes in NotePad, not in Windows Forms .NET

314 views Asked by At

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;
        }
    }

}

1

There are 1 answers

0
Manuel Roldan On

Finally I found out the solution. It was a matter of connection. I had connected the device via the software provided by the carrier. It would have been better connected it via Windows utilities. I decided to write here my solution in order to other users who may have the same problem to solve it. Thank you for your time to those who took some time trying to help me.