0
votes

The WebBrowser control I have is popping up and displaying the URL correctly, but for some reason I can't type anything in text fields. I can click on text fields and give them focus, and I can paste text into text fields, but I can't type in them with the keyboard. This happens regardless of what URL I type in.

I set AllowWebBrowserDrop to false, but otherwise all the settings for the WebBrowser control and the form it lives in are standard.

Very similar code using a WebBrowser works fine in .NET 3.5, but I'm relying on an API that's still .NET 2.0 only. Plus, this seems like pretty rudimentary functionality that someone would have noticed not working.

Here's the constructor for the form the WebBrowser is contained in:

public partial class LoginWindow : Form
{
    Main mainPlugin;
    public LoginWindow(string loginurl, Main plugin)
    {
        this.mainPlugin = plugin;
        try
        {

            //Debug.WriteLine(loginurl);
            InitializeComponent();
            webBrowser1.AllowWebBrowserDrop = false;
            webBrowser1.Url = new Uri(loginurl);
        }
        catch (Exception ex)
        {
            //Globals.ThisAddIn.ul.writeExceptionInfo(ex);
            MessageBox.Show("Error creating the browser. (LB_01) \n \n " + ex.GetType().ToString() + "\n\n" + ex.ToString(), "Error");
        }
    }

Any ideas?

2
A .NET 2.0 API? What might that be? Why doesn't it work on .NET 3.5? Did you actually uninstall 3.5 and only left 2.0 on the machine? - Hans Passant
It's a custom API to enable plugin development for Windows Live mail v9. I have both APIs on my machine; I just need to link against the 2.0 version of .NET, otherwise my project fails to compile. - Aaron
Using .NET 3.5 makes no difference. .NET 3.5 is a superset of .NET 2.0. There isn't a .NET 3.5 version of System.Windows.Forms.dll. - P Daddy

2 Answers

1
votes

This turned out to be related to a bug in .NET 2.0. I have since then started using a library that is based on .NET version 3.5 without issue.

0
votes

Not sure what the problem is, but perhaps you could add a on-keypress event to the webbrowser control and then redirect that text to the focused text box.