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?
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.
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.
精彩评论