Hi again, i want to use on sceen keyboard when i want to click/touch a textbox, i tried to do a keyboard in vb.net but it can only focus on one form only. Can you give any idea how can i use on screen keyboard or how can i focus my keyaboard in all forms that have a textbox?Please Help , thank you :)

I'm not sure I see the problem. If you run osk.exe then click in a textbox to give it focus, whatever keys you click in osk will be sent to that textbox. If you want the keys to go to a different form or textbox then give that textbox focus.

ok i got it, thank you

but how can i send the button text in textbox when i click the button?

If you mean a button from the on-screen keyboard then reread my post. However, I suspect you are meaning that you created your own keyboard. In that case you will need a class level variable to keep track of the last non-keyboard control that had focus. In the click event for a keyboard button you can add the clicked key text to the last textbox.

yeah, i created my keyboard since i dont know how to use osk.

You can find osk.exe in C:\Windows\System32. Run it and play with it. You will probably be able to avoid writing a lot of code.

@Reverend Jim
i tried this code but it says that "Could Not Start On Screen Keyboard"
i search everywhere but they say it works one them, im using 64bit OS

 Private Sub TextBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Click
        Process.Start("C:\Windows\System32\OSK.EXE")
    End Sub

i already try this code in my 32bit Os and its working , but when i use it in my 64bit OS , its not working, what would be the problem?

Just to check your system is o.k. copy OSK.EXE into the command line where it says "search programs and files" and start it from there outside of your program. If it works than there is something in your program preventing it from running. You might be able to run it without directory reference like:
Process.Start("OSK.EXE")

@Minimalist, it works, but the OSK is pop up in outside the system when i click the textbox, what i really want is when i click a textbox it will pop up in the form

There is some code for manipulation of the keyboard here:
http://hot-virtual-keyboard.com/development/q1/
I believe it is not possible to place it within a form in vb.net as it is a part of the operating system like notebook. You might be able to use the position to place it over your form.

Apparently it has to do with launching a 32 bit app (osk). Try the following...

Public Class Form1

    Declare Function Wow64DisableWow64FsRedirection Lib "kernel32" (ByRef oldvalue As Long) As Boolean

    Private osk As String = "C:\Windows\System32\osk.exe"

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

        Wow64DisableWow64FsRedirection(0)
        Process.Start(osk)

    End Sub

End Class

This works fine for me on windows7 64 bit:

Private Sub TextBox1_MouseClick(sender As Object, e As MouseEventArgs) Handles TextBox1.MouseClick
        Process.Start("OSK.EXE")
    End Sub

Further research shows you should use the following...

Public Class Form1

    Declare Function Wow64DisableWow64FsRedirection Lib "kernel32" (ByRef oldvalue As Long) As Boolean
    Declare Function Wow64EnableWow64FsRedirection Lib "kernel32" (ByRef oldvalue As Long) As Boolean

    Private osk As String = "C:\Windows\System32\osk.exe"

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

        Dim old As Long

        If Environment.Is64BitOperatingSystem Then
            If Wow64DisableWow64FsRedirection(old) Then
                Process.Start(osk)
                Wow64EnableWow64FsRedirection(old)
            End If
        Else
            Process.Start(osk)
        End If

    End Sub

End Class

You want to wrap the invocation of osk.exe with disable/enable because disabling redirection affects all I/O operations in the current thread and you only want to disable it so that you can start osk.

@Reverend Jim, wow thank you, it works now on my system, i tried to use it in textbox.MouseClick and it works. :) , thank you again. I tried to do a keyboard in a form but having trouble in sendkeys and focus on textboxes , that's why i try osk.exe that you mention to me. Thank you. I got a short code now :D

@Minimalist, thanks for helping, it works on my 32bit OS but i still got an error when i try it in 64bit Os.

Any time. The questions I like the best are the ones where I get to learn something new.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.