本文介绍了如何winform texboxt文本传输价值的网页文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有 textbox1
,我想将 textbox1.Text
转移到 webbrowser1
网页文本框,如何做到这一点?
I have textbox1
, I want to transfer textbox1.Text
into webbrowser1
web page textbox, how to do this?
我有以下代码,但网页文本框选择索引更改事件未触发。如何做到这一点?
I have below code, but webpage text box selected index change event not fired. How to do this?
private void button2_Click(object sender, EventArgs e)
{
HtmlDocument doc = webBrowser1.Document;
HtmlElement HTMLControl2 = doc.GetElementById("flightno-filter");
//HTMLControl.Style = "'display: none;'";
if (HTMLControl2 != null)
{
// HTMLControl2.Style = "display: none";
HTMLControl2.InnerText = textBox1.Text;
}
}
请参阅下面的图片
推荐答案
文本到网页,然后使浏览器提高输入框的更改/输入事件?您必须调用onChange事件或其他一些事件。
You're trying to input text to webpage then make make the webbrowser raise the change/input event of the input box? You have to invoke "onChange" event or some other event.
Bellow我使WebBrowser提高keydown事件,使用SendKey:
Bellow I make WebBrowser raise keydown event, use SendKey:
private void button2_Click(object sender, EventArgs e)
{
HtmlDocument doc = webBrowser1.Document;
HtmlElement HTMLControl2 = doc.GetElementById("flightno-filter");
//HTMLControl.Style = "'display: none;'";
if (HTMLControl2 != null)
{
// HTMLControl2.Style = "display: none";
HTMLControl2.InnerText = textBox1.Text;
HTMLControl2.Focus(); // Set focus to input box
SendKeys.SendWait("{Right}"); // Send "Right" key
textBox1.Focus(); // Give focus back for one of WinForms control
}
}
这篇关于如何winform texboxt文本传输价值的网页文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!