SamuraiJack
SamuraiJack

Reputation: 5539

How to prevent a textbox inside Webbrowser control from losing focus when user clicks outside webbrowser control?

I have a winform application in which I have a Virtual Keypad. The following code (with textBox1 as winform textbox works fine:

 protected void touchScreen1_OnUserControlButtonClicked(object sender, EventArgs e)
        {
            textBox1.Focus();
          InputSimulator inputSimulator = new InputSimulator();
          inputSimulator.Keyboard.KeyDown(WindowsInput.Native.VirtualKeyCode.NUMPAD1); 
        }

But problem is that I am going to be typing inside a textbox which is not a windows forms control. I will be typing in a textbox which is a part of webpage loaded in webbrowser. Therefore I have no context. I can not explicit shift the focus to it. What do I do? Everytime I click the virtual key I have designed, it takes the focus out of the textbox in webcontrol and therefore does not type.

Upvotes: 1

Views: 42

Answers (0)

Related Questions