Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2013 Storing Keyboard Values and Displaying them?

$
0
0
I have a different keyboard that has to use the pos.net class and queue a data event to read a key on the keyboard. Its an Ibm retail 50 key

I created a module because I want to store all of the key functions in it.


Code:

Module - Key Defintions

Dim NumberOneKey as integer = 1
Dim NumberTwoKey as Integer = 2
...

My form

Code:

Public Class Main
    WithEvents Explorer As PosExplorer
    WithEvents ibmposkeyboard As PosKeyboard
    Public Sub New()

        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        Explorer = New PosExplorer(Me)

        Dim Device As DeviceInfo = Explorer.GetDevice("poskeyboard")
        ibmposkeyboard = Explorer.CreateInstance(Device)

    End Sub
    Private Sub Main_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        ibmposkeyboard.Open()
        ibmposkeyboard.Claim(5000)
        ibmposkeyboard.DeviceEnabled = True
        ibmposkeyboard.DataEventEnabled = True

    End Sub

    Private Sub ibmposkeyboard_DataEvent(sender As Object, e As DataEventArgs) Handles ibmposkeyboard.DataEvent
        If ibmposkeyboard.PosKeyData = " HELP HERE    " Then
            RichTextBox1.Text = "  HELP HERE  "
            ibmposkeyboard.DataEventEnabled = True

        End If

    End Sub

    Private Sub ibmposkeyboard_ErrorEvent(sender As Object, e As DeviceErrorEventArgs) Handles ibmposkeyboard.ErrorEvent
        MsgBox("There was an error")
        ibmposkeyboard.DataEventEnabled = False
        ibmposkeyboard.DeviceEnabled = False
        ibmposkeyboard.ClearInput()
        ibmposkeyboard.Close()
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        MsgBox("Exiting and Shutting Down Pos Keyboard")
        ibmposkeyboard.DataEventEnabled = False
        ibmposkeyboard.DeviceEnabled = False
        ibmposkeyboard.ClearInput()
        ibmposkeyboard.Close()
        Application.Exit()
    End Sub
End Class


When I press the number one key the, poskeydata function should know it was pressed and output a 1 into the textbox. The definition is in the module.
I already have the translation with hex setup on the computer translation file for IBM OPOS .

How do I retrieve the value from the module? I need to define all 50 keys. I am trying to create an application , for this pos keyboard to program the keys.


Thanks

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>