Take the 2-minute tour ×

I developed an outlook add in (custom task pane), with web browser in the user control.

All the things working well beside the backspace or the delete button when I am writing something in text box in the web browser, I cant use those keys, am I missing something?

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

Ok I solved the problem ,

The problem is that the custom task pane in not always gets fucos from the outlook.

So, I raised an event every time that there is "onclick" for all the pane, and then forced the pane to be in focus.

share|improve this answer
How exactly did you do this? Can you post some code? I am having the same problem but nothing I do helps. –  wpfwannabe May 19 '11 at 8:23
add comment

Turns out this is an easy issue to fix.

Just write

class MyBrowser : WebBrowser {}

Then use MyBrowser instead of the .NET one.

share|improve this answer
This did not work for me. –  GreenKiwi Nov 14 '13 at 21:05
That's Odd. I tried this approach multiple times just to be sure. It made absolutely no sense either and still doesn't. –  Vince Panuccio Nov 18 '13 at 7:21
add comment

I am a few years late to the party but I managed to fix this. The easiest way to fix this is to ensure proper focus is given to the input fields, so you will need to be able to run your own javascript on whatever page is being loaded.

The javascript I run on the page is as follows (using jQuery):

$(document).on("click", function (e) {
  // first let the add-in give focus to our CustomTaskPane
  // then in our web browser give focus to whatever element was clicked on

the window.external variable contains code run from the plugin (c# or VB I assume) which is exposed so we can interact from web page back to the add-in.

In the add-in code for the custom taskpane set the context of window.external:

// event when webBrowser is finished loading document
private void webBrowser1_DocumentCompleted(object sender,     WebBrowserDocumentCompletedEventArgs e)
        // sets context of window.external to functions defined on this context
        webBrowser1.ObjectForScripting = this;

And a public method for focusing:

// can be called by the web browser as window.external.focus()
public void focus()

This worked for me, and I hope it helps others. Although do note that this probably doesn't work if the user keyboard navigates using tab, but you can either extend this code for that use case, or safely assume that the average outlook user will have his hand glued to the mouse.

share|improve this answer
add comment

Your Answer


