Hi,
>i am trying to create a simple on screen keyboard where one of the commandbutton represents Enter key.
Where is the command button that simulates the enter key? The reason for asking this is that if the button is on a form, clicking the button moves the focus to the button. The enter key would then be send to the button, not the textbox. There are two ways around that:
a) You could add the button to a toolbar. Toolbars never receive the focus. To nicely arrange buttons inside the toolbar, you can add a container of the desired size and place the buttons inside the container.
b) In the click method of the button first call the textbox's SetFocus() method then simulate the key stroke. However, this has some more impact as setting the focus to a textbox not only triggers the whole validation process, it also moves the current cursor position.
BTW, if all you need is an on screen keyboard, have you checked out OSK.EXE which comes with Windows?
--
Christof