Virtual keyboard

Hello,

I need to implement virtual keyboard in VB.NET. It must send its characters to the current textbox or control
f_asmaaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

planoczCommented:
try this sample code in your form....
 
  Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean
        Const WM_KEYDOWN As Integer = &H100
        Const WM_SYSKEYDOWN As Integer = &H104
        Dim e As System.EventArgs

        If ((msg.Msg = WM_KEYDOWN) Or (msg.Msg = WM_SYSKEYDOWN)) Then
            Select Case (keyData)
                'The Number Key Pads, 10 key and regular 0-9 keys
            Case Keys.NumPad0, Keys.D0
                Case Keys.NumPad1, Keys.D1
                Case Keys.NumPad2, Keys.D2
                Case Keys.NumPad3, Keys.D3
                Case Keys.NumPad4, Keys.D4
                Case Keys.NumPad5, Keys.D5
                Case Keys.NumPad6, Keys.D6
                Case Keys.NumPad7, Keys.D7
                Case Keys.NumPad8, Keys.D8
                Case Keys.NumPad9, Keys.D9
                Case Keys.Down
                    MyStr = RichTextBox1.SelectionType = RichTextBoxSelectionTypes.Object
                    'The Other Number Key Pads keys
                Case Keys.Add, Keys.Oemplus
                Case Keys.Divide, Keys.OemQuestion
                Case Keys.Multiply, Keys.X
                Case Keys.Subtract, Keys.OemMinus
                Case Keys.Decimal
                Case Keys.Enter

                Case Keys.Back Or (Keys.Alt Or Keys.Back)
                Case (Keys.Alt Or Keys.D1) Or (Keys.Alt Or Keys.NumPad1)
                Case (Keys.Alt Or Keys.Oemplus)
                Case (Keys.Alt Or Keys.C)
                Case (Keys.Alt And Keys.Add)
                Case (Keys.Alt Or Keys.Q)
                Case (Keys.Alt Or Keys.D5)
                Case (Keys.Alt Or Keys.R)
                Case (Keys.Alt Or Keys.E)
                    'Do something
                Case Keys.C, Keys.Escape  'Use for clearing display
                   'Do something
            End Select
        End If
        Return MyBase.ProcessCmdKey(msg, keyData)
    End Function
0
GlomCommented:
Hi,

If you just want to simulate key strokes, then use this simple function :

SendKeys.Send(YourString)
0
Mike TomlinsonMiddle School Assistant TeacherCommented:
This should give you a really good start.  The form has the WS_EX_NOACTIVATE  flag set so it doesn't steal the focus.  This allows the SendKeys() function to actually send the keys to the window that currently has the focus:

Imports System.Runtime.InteropServices

Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents Button3 As System.Windows.Forms.Button
    Friend WithEvents Button4 As System.Windows.Forms.Button
    Friend WithEvents Button5 As System.Windows.Forms.Button
    Friend WithEvents Button6 As System.Windows.Forms.Button
    Friend WithEvents Button7 As System.Windows.Forms.Button
    Friend WithEvents Button8 As System.Windows.Forms.Button
    Friend WithEvents Button9 As System.Windows.Forms.Button
    Friend WithEvents Button10 As System.Windows.Forms.Button
    Friend WithEvents Button11 As System.Windows.Forms.Button
    Friend WithEvents Button12 As System.Windows.Forms.Button
    Friend WithEvents Button13 As System.Windows.Forms.Button
    Friend WithEvents Button15 As System.Windows.Forms.Button
    Friend WithEvents Button16 As System.Windows.Forms.Button
    Friend WithEvents Button17 As System.Windows.Forms.Button
    Friend WithEvents Button18 As System.Windows.Forms.Button
    Friend WithEvents Button19 As System.Windows.Forms.Button
    Friend WithEvents Button20 As System.Windows.Forms.Button
    Friend WithEvents Button21 As System.Windows.Forms.Button
    Friend WithEvents Button22 As System.Windows.Forms.Button
    Friend WithEvents Button23 As System.Windows.Forms.Button
    Friend WithEvents Button24 As System.Windows.Forms.Button
    Friend WithEvents Button25 As System.Windows.Forms.Button
    Friend WithEvents Button26 As System.Windows.Forms.Button
    Friend WithEvents Button29 As System.Windows.Forms.Button
    Friend WithEvents Button30 As System.Windows.Forms.Button
    Friend WithEvents Button31 As System.Windows.Forms.Button
    Friend WithEvents Button32 As System.Windows.Forms.Button
    Friend WithEvents Button33 As System.Windows.Forms.Button
    Friend WithEvents Button34 As System.Windows.Forms.Button
    Friend WithEvents Button35 As System.Windows.Forms.Button
    Friend WithEvents Button36 As System.Windows.Forms.Button
    Friend WithEvents Button37 As System.Windows.Forms.Button
    Friend WithEvents Button38 As System.Windows.Forms.Button
    Friend WithEvents Button14 As System.Windows.Forms.Button
    Friend WithEvents Button28 As System.Windows.Forms.Button
    Friend WithEvents Button39 As System.Windows.Forms.Button
    Friend WithEvents Button40 As System.Windows.Forms.Button
    Friend WithEvents Button41 As System.Windows.Forms.Button
    Friend WithEvents Button42 As System.Windows.Forms.Button
    Friend WithEvents Button43 As System.Windows.Forms.Button
    Friend WithEvents Button44 As System.Windows.Forms.Button
    Friend WithEvents Button45 As System.Windows.Forms.Button
    Friend WithEvents Button46 As System.Windows.Forms.Button
    Friend WithEvents Button47 As System.Windows.Forms.Button
    Friend WithEvents Button48 As System.Windows.Forms.Button
    Friend WithEvents Button49 As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Button1 = New System.Windows.Forms.Button
        Me.Button2 = New System.Windows.Forms.Button
        Me.Button3 = New System.Windows.Forms.Button
        Me.Button4 = New System.Windows.Forms.Button
        Me.Button5 = New System.Windows.Forms.Button
        Me.Button6 = New System.Windows.Forms.Button
        Me.Button7 = New System.Windows.Forms.Button
        Me.Button8 = New System.Windows.Forms.Button
        Me.Button9 = New System.Windows.Forms.Button
        Me.Button10 = New System.Windows.Forms.Button
        Me.Button11 = New System.Windows.Forms.Button
        Me.Button12 = New System.Windows.Forms.Button
        Me.Button13 = New System.Windows.Forms.Button
        Me.Button15 = New System.Windows.Forms.Button
        Me.Button16 = New System.Windows.Forms.Button
        Me.Button17 = New System.Windows.Forms.Button
        Me.Button18 = New System.Windows.Forms.Button
        Me.Button19 = New System.Windows.Forms.Button
        Me.Button20 = New System.Windows.Forms.Button
        Me.Button21 = New System.Windows.Forms.Button
        Me.Button22 = New System.Windows.Forms.Button
        Me.Button23 = New System.Windows.Forms.Button
        Me.Button24 = New System.Windows.Forms.Button
        Me.Button25 = New System.Windows.Forms.Button
        Me.Button26 = New System.Windows.Forms.Button
        Me.Button29 = New System.Windows.Forms.Button
        Me.Button30 = New System.Windows.Forms.Button
        Me.Button31 = New System.Windows.Forms.Button
        Me.Button32 = New System.Windows.Forms.Button
        Me.Button33 = New System.Windows.Forms.Button
        Me.Button34 = New System.Windows.Forms.Button
        Me.Button35 = New System.Windows.Forms.Button
        Me.Button36 = New System.Windows.Forms.Button
        Me.Button37 = New System.Windows.Forms.Button
        Me.Button38 = New System.Windows.Forms.Button
        Me.Button14 = New System.Windows.Forms.Button
        Me.Button28 = New System.Windows.Forms.Button
        Me.Button39 = New System.Windows.Forms.Button
        Me.Button40 = New System.Windows.Forms.Button
        Me.Button41 = New System.Windows.Forms.Button
        Me.Button42 = New System.Windows.Forms.Button
        Me.Button43 = New System.Windows.Forms.Button
        Me.Button44 = New System.Windows.Forms.Button
        Me.Button45 = New System.Windows.Forms.Button
        Me.Button46 = New System.Windows.Forms.Button
        Me.Button47 = New System.Windows.Forms.Button
        Me.Button48 = New System.Windows.Forms.Button
        Me.Button49 = New System.Windows.Forms.Button
        Me.SuspendLayout()
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(16, 32)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(24, 24)
        Me.Button1.TabIndex = 0
        Me.Button1.Text = "Q"
        '
        'Button2
        '
        Me.Button2.Location = New System.Drawing.Point(40, 32)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(24, 24)
        Me.Button2.TabIndex = 1
        Me.Button2.Text = "W"
        '
        'Button3
        '
        Me.Button3.Location = New System.Drawing.Point(64, 32)
        Me.Button3.Name = "Button3"
        Me.Button3.Size = New System.Drawing.Size(24, 24)
        Me.Button3.TabIndex = 2
        Me.Button3.Text = "E"
        '
        'Button4
        '
        Me.Button4.Location = New System.Drawing.Point(88, 32)
        Me.Button4.Name = "Button4"
        Me.Button4.Size = New System.Drawing.Size(24, 24)
        Me.Button4.TabIndex = 3
        Me.Button4.Text = "R"
        '
        'Button5
        '
        Me.Button5.Location = New System.Drawing.Point(112, 32)
        Me.Button5.Name = "Button5"
        Me.Button5.Size = New System.Drawing.Size(24, 24)
        Me.Button5.TabIndex = 4
        Me.Button5.Text = "T"
        '
        'Button6
        '
        Me.Button6.Location = New System.Drawing.Point(136, 32)
        Me.Button6.Name = "Button6"
        Me.Button6.Size = New System.Drawing.Size(24, 24)
        Me.Button6.TabIndex = 5
        Me.Button6.Text = "Y"
        '
        'Button7
        '
        Me.Button7.Location = New System.Drawing.Point(160, 32)
        Me.Button7.Name = "Button7"
        Me.Button7.Size = New System.Drawing.Size(24, 24)
        Me.Button7.TabIndex = 6
        Me.Button7.Text = "U"
        '
        'Button8
        '
        Me.Button8.Location = New System.Drawing.Point(184, 32)
        Me.Button8.Name = "Button8"
        Me.Button8.Size = New System.Drawing.Size(24, 24)
        Me.Button8.TabIndex = 7
        Me.Button8.Text = "I"
        '
        'Button9
        '
        Me.Button9.Location = New System.Drawing.Point(208, 32)
        Me.Button9.Name = "Button9"
        Me.Button9.Size = New System.Drawing.Size(24, 24)
        Me.Button9.TabIndex = 8
        Me.Button9.Text = "O"
        '
        'Button10
        '
        Me.Button10.Location = New System.Drawing.Point(232, 32)
        Me.Button10.Name = "Button10"
        Me.Button10.Size = New System.Drawing.Size(24, 24)
        Me.Button10.TabIndex = 9
        Me.Button10.Text = "P"
        '
        'Button11
        '
        Me.Button11.Location = New System.Drawing.Point(256, 32)
        Me.Button11.Name = "Button11"
        Me.Button11.Size = New System.Drawing.Size(24, 24)
        Me.Button11.TabIndex = 10
        Me.Button11.Text = "["
        '
        'Button12
        '
        Me.Button12.Location = New System.Drawing.Point(280, 32)
        Me.Button12.Name = "Button12"
        Me.Button12.Size = New System.Drawing.Size(24, 24)
        Me.Button12.TabIndex = 11
        Me.Button12.Text = "]"
        '
        'Button13
        '
        Me.Button13.Location = New System.Drawing.Point(304, 32)
        Me.Button13.Name = "Button13"
        Me.Button13.Size = New System.Drawing.Size(24, 24)
        Me.Button13.TabIndex = 12
        Me.Button13.Text = "\"
        '
        'Button15
        '
        Me.Button15.Location = New System.Drawing.Point(288, 56)
        Me.Button15.Name = "Button15"
        Me.Button15.Size = New System.Drawing.Size(40, 24)
        Me.Button15.TabIndex = 24
        Me.Button15.Text = "Enter"
        '
        'Button16
        '
        Me.Button16.Location = New System.Drawing.Point(264, 56)
        Me.Button16.Name = "Button16"
        Me.Button16.Size = New System.Drawing.Size(24, 24)
        Me.Button16.TabIndex = 23
        Me.Button16.Text = "'"
        '
        'Button17
        '
        Me.Button17.Location = New System.Drawing.Point(240, 56)
        Me.Button17.Name = "Button17"
        Me.Button17.Size = New System.Drawing.Size(24, 24)
        Me.Button17.TabIndex = 22
        Me.Button17.Text = ";"
        '
        'Button18
        '
        Me.Button18.Location = New System.Drawing.Point(216, 56)
        Me.Button18.Name = "Button18"
        Me.Button18.Size = New System.Drawing.Size(24, 24)
        Me.Button18.TabIndex = 21
        Me.Button18.Text = "L"
        '
        'Button19
        '
        Me.Button19.Location = New System.Drawing.Point(192, 56)
        Me.Button19.Name = "Button19"
        Me.Button19.Size = New System.Drawing.Size(24, 24)
        Me.Button19.TabIndex = 20
        Me.Button19.Text = "K"
        '
        'Button20
        '
        Me.Button20.Location = New System.Drawing.Point(168, 56)
        Me.Button20.Name = "Button20"
        Me.Button20.Size = New System.Drawing.Size(24, 24)
        Me.Button20.TabIndex = 19
        Me.Button20.Text = "J"
        '
        'Button21
        '
        Me.Button21.Location = New System.Drawing.Point(144, 56)
        Me.Button21.Name = "Button21"
        Me.Button21.Size = New System.Drawing.Size(24, 24)
        Me.Button21.TabIndex = 18
        Me.Button21.Text = "H"
        '
        'Button22
        '
        Me.Button22.Location = New System.Drawing.Point(120, 56)
        Me.Button22.Name = "Button22"
        Me.Button22.Size = New System.Drawing.Size(24, 24)
        Me.Button22.TabIndex = 17
        Me.Button22.Text = "G"
        '
        'Button23
        '
        Me.Button23.Location = New System.Drawing.Point(96, 56)
        Me.Button23.Name = "Button23"
        Me.Button23.Size = New System.Drawing.Size(24, 24)
        Me.Button23.TabIndex = 16
        Me.Button23.Text = "F"
        '
        'Button24
        '
        Me.Button24.Location = New System.Drawing.Point(72, 56)
        Me.Button24.Name = "Button24"
        Me.Button24.Size = New System.Drawing.Size(24, 24)
        Me.Button24.TabIndex = 15
        Me.Button24.Text = "D"
        '
        'Button25
        '
        Me.Button25.Location = New System.Drawing.Point(48, 56)
        Me.Button25.Name = "Button25"
        Me.Button25.Size = New System.Drawing.Size(24, 24)
        Me.Button25.TabIndex = 14
        Me.Button25.Text = "S"
        '
        'Button26
        '
        Me.Button26.Location = New System.Drawing.Point(24, 56)
        Me.Button26.Name = "Button26"
        Me.Button26.Size = New System.Drawing.Size(24, 24)
        Me.Button26.TabIndex = 13
        Me.Button26.Text = "A"
        '
        'Button29
        '
        Me.Button29.Location = New System.Drawing.Point(248, 80)
        Me.Button29.Name = "Button29"
        Me.Button29.Size = New System.Drawing.Size(24, 24)
        Me.Button29.TabIndex = 34
        Me.Button29.Text = "/"
        '
        'Button30
        '
        Me.Button30.Location = New System.Drawing.Point(224, 80)
        Me.Button30.Name = "Button30"
        Me.Button30.Size = New System.Drawing.Size(24, 24)
        Me.Button30.TabIndex = 33
        Me.Button30.Text = "."
        '
        'Button31
        '
        Me.Button31.Location = New System.Drawing.Point(200, 80)
        Me.Button31.Name = "Button31"
        Me.Button31.Size = New System.Drawing.Size(24, 24)
        Me.Button31.TabIndex = 32
        Me.Button31.Text = ","
        '
        'Button32
        '
        Me.Button32.Location = New System.Drawing.Point(176, 80)
        Me.Button32.Name = "Button32"
        Me.Button32.Size = New System.Drawing.Size(24, 24)
        Me.Button32.TabIndex = 31
        Me.Button32.Text = "M"
        '
        'Button33
        '
        Me.Button33.Location = New System.Drawing.Point(152, 80)
        Me.Button33.Name = "Button33"
        Me.Button33.Size = New System.Drawing.Size(24, 24)
        Me.Button33.TabIndex = 30
        Me.Button33.Text = "N"
        '
        'Button34
        '
        Me.Button34.Location = New System.Drawing.Point(128, 80)
        Me.Button34.Name = "Button34"
        Me.Button34.Size = New System.Drawing.Size(24, 24)
        Me.Button34.TabIndex = 29
        Me.Button34.Text = "B"
        '
        'Button35
        '
        Me.Button35.Location = New System.Drawing.Point(104, 80)
        Me.Button35.Name = "Button35"
        Me.Button35.Size = New System.Drawing.Size(24, 24)
        Me.Button35.TabIndex = 28
        Me.Button35.Text = "V"
        '
        'Button36
        '
        Me.Button36.Location = New System.Drawing.Point(80, 80)
        Me.Button36.Name = "Button36"
        Me.Button36.Size = New System.Drawing.Size(24, 24)
        Me.Button36.TabIndex = 27
        Me.Button36.Text = "C"
        '
        'Button37
        '
        Me.Button37.Location = New System.Drawing.Point(56, 80)
        Me.Button37.Name = "Button37"
        Me.Button37.Size = New System.Drawing.Size(24, 24)
        Me.Button37.TabIndex = 26
        Me.Button37.Text = "X"
        '
        'Button38
        '
        Me.Button38.Location = New System.Drawing.Point(32, 80)
        Me.Button38.Name = "Button38"
        Me.Button38.Size = New System.Drawing.Size(24, 24)
        Me.Button38.TabIndex = 25
        Me.Button38.Text = "Z"
        '
        'Button14
        '
        Me.Button14.Location = New System.Drawing.Point(64, 104)
        Me.Button14.Name = "Button14"
        Me.Button14.Size = New System.Drawing.Size(152, 24)
        Me.Button14.TabIndex = 35
        Me.Button14.Text = "Space"
        '
        'Button28
        '
        Me.Button28.Location = New System.Drawing.Point(272, 8)
        Me.Button28.Name = "Button28"
        Me.Button28.Size = New System.Drawing.Size(56, 24)
        Me.Button28.TabIndex = 47
        Me.Button28.Text = "Back"
        '
        'Button39
        '
        Me.Button39.Location = New System.Drawing.Point(248, 8)
        Me.Button39.Name = "Button39"
        Me.Button39.Size = New System.Drawing.Size(24, 24)
        Me.Button39.TabIndex = 46
        Me.Button39.Text = "="
        '
        'Button40
        '
        Me.Button40.Location = New System.Drawing.Point(224, 8)
        Me.Button40.Name = "Button40"
        Me.Button40.Size = New System.Drawing.Size(24, 24)
        Me.Button40.TabIndex = 45
        Me.Button40.Text = "-"
        '
        'Button41
        '
        Me.Button41.Location = New System.Drawing.Point(200, 8)
        Me.Button41.Name = "Button41"
        Me.Button41.Size = New System.Drawing.Size(24, 24)
        Me.Button41.TabIndex = 44
        Me.Button41.Text = "9"
        '
        'Button42
        '
        Me.Button42.Location = New System.Drawing.Point(176, 8)
        Me.Button42.Name = "Button42"
        Me.Button42.Size = New System.Drawing.Size(24, 24)
        Me.Button42.TabIndex = 43
        Me.Button42.Text = "8"
        '
        'Button43
        '
        Me.Button43.Location = New System.Drawing.Point(152, 8)
        Me.Button43.Name = "Button43"
        Me.Button43.Size = New System.Drawing.Size(24, 24)
        Me.Button43.TabIndex = 42
        Me.Button43.Text = "7"
        '
        'Button44
        '
        Me.Button44.Location = New System.Drawing.Point(128, 8)
        Me.Button44.Name = "Button44"
        Me.Button44.Size = New System.Drawing.Size(24, 24)
        Me.Button44.TabIndex = 41
        Me.Button44.Text = "6"
        '
        'Button45
        '
        Me.Button45.Location = New System.Drawing.Point(104, 8)
        Me.Button45.Name = "Button45"
        Me.Button45.Size = New System.Drawing.Size(24, 24)
        Me.Button45.TabIndex = 40
        Me.Button45.Text = "5"
        '
        'Button46
        '
        Me.Button46.Location = New System.Drawing.Point(80, 8)
        Me.Button46.Name = "Button46"
        Me.Button46.Size = New System.Drawing.Size(24, 24)
        Me.Button46.TabIndex = 39
        Me.Button46.Text = "4"
        '
        'Button47
        '
        Me.Button47.Location = New System.Drawing.Point(56, 8)
        Me.Button47.Name = "Button47"
        Me.Button47.Size = New System.Drawing.Size(24, 24)
        Me.Button47.TabIndex = 38
        Me.Button47.Text = "3"
        '
        'Button48
        '
        Me.Button48.Location = New System.Drawing.Point(32, 8)
        Me.Button48.Name = "Button48"
        Me.Button48.Size = New System.Drawing.Size(24, 24)
        Me.Button48.TabIndex = 37
        Me.Button48.Text = "2"
        '
        'Button49
        '
        Me.Button49.Location = New System.Drawing.Point(8, 8)
        Me.Button49.Name = "Button49"
        Me.Button49.Size = New System.Drawing.Size(24, 24)
        Me.Button49.TabIndex = 36
        Me.Button49.Text = "1"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(336, 134)
        Me.Controls.Add(Me.Button28)
        Me.Controls.Add(Me.Button39)
        Me.Controls.Add(Me.Button40)
        Me.Controls.Add(Me.Button41)
        Me.Controls.Add(Me.Button42)
        Me.Controls.Add(Me.Button43)
        Me.Controls.Add(Me.Button44)
        Me.Controls.Add(Me.Button45)
        Me.Controls.Add(Me.Button46)
        Me.Controls.Add(Me.Button47)
        Me.Controls.Add(Me.Button48)
        Me.Controls.Add(Me.Button49)
        Me.Controls.Add(Me.Button14)
        Me.Controls.Add(Me.Button29)
        Me.Controls.Add(Me.Button30)
        Me.Controls.Add(Me.Button31)
        Me.Controls.Add(Me.Button32)
        Me.Controls.Add(Me.Button33)
        Me.Controls.Add(Me.Button34)
        Me.Controls.Add(Me.Button35)
        Me.Controls.Add(Me.Button36)
        Me.Controls.Add(Me.Button37)
        Me.Controls.Add(Me.Button38)
        Me.Controls.Add(Me.Button15)
        Me.Controls.Add(Me.Button16)
        Me.Controls.Add(Me.Button17)
        Me.Controls.Add(Me.Button18)
        Me.Controls.Add(Me.Button19)
        Me.Controls.Add(Me.Button20)
        Me.Controls.Add(Me.Button21)
        Me.Controls.Add(Me.Button22)
        Me.Controls.Add(Me.Button23)
        Me.Controls.Add(Me.Button24)
        Me.Controls.Add(Me.Button25)
        Me.Controls.Add(Me.Button26)
        Me.Controls.Add(Me.Button13)
        Me.Controls.Add(Me.Button12)
        Me.Controls.Add(Me.Button11)
        Me.Controls.Add(Me.Button10)
        Me.Controls.Add(Me.Button9)
        Me.Controls.Add(Me.Button8)
        Me.Controls.Add(Me.Button7)
        Me.Controls.Add(Me.Button6)
        Me.Controls.Add(Me.Button5)
        Me.Controls.Add(Me.Button4)
        Me.Controls.Add(Me.Button3)
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.Button1)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
        Me.MaximizeBox = False
        Me.Name = "Form1"
        Me.Text = "OnScreen KeyBoard"
        Me.TopMost = True
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Const WS_EX_NOACTIVATE = &H8000000
    Private Const WM_MOVING = &H216

    Private Structure RECT
        Public Left As Integer
        Public Top As Integer
        Public Right As Integer
        Public Bottom As Integer
    End Structure

    Protected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams
        Get
            Dim cp As CreateParams = MyBase.CreateParams
            cp.ExStyle = cp.ExStyle Or WS_EX_NOACTIVATE
            Return cp
        End Get
    End Property

    Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
        If m.Msg = WM_MOVING Then
            Dim r As RECT
            r = DirectCast(Marshal.PtrToStructure(m.LParam, GetType(RECT)), RECT)
            Me.Location = New Point(r.Left, r.Top)
        End If

        MyBase.WndProc(m)
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim c As Control
        Dim b As Button
        For Each c In Me.Controls
            If TypeOf c Is Button Then
                b = CType(c, Button)
                AddHandler b.Click, AddressOf Me.Button_Click
            End If
        Next
    End Sub

    Private Sub Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim t As String = sender.text
        If t = "Back" Then
            SendKeys.Send("{BACKSPACE}")
        ElseIf t = "Enter" Then
            SendKeys.Send("{ENTER}")
        ElseIf t = "Space" Then
            SendKeys.Send(" ")
        Else
            SendKeys.Send(t)
        End If
    End Sub

End Class

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

iboutchkineCommented:
If you are using WIn XP, it already has a virtual keyboard. Go to Start-Run and type osk. You can call this from your app. Why do you need to reinvent  a wheel?
0
f_asmaaAuthor Commented:
Because I want to disable some keys in Windows Virtual keyboard
0
vitotoCommented:
Hi, how i can send Num Pad 0

I need check Num lock status and Active for Send this Key.

Thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Storage Software

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.