我不明白爲什麼我會收到Specified cast is not valid
錯誤。它發生在HtmlElement
變量newElement
上。正在通過 System.Threading.Timer
回調函數moreInfo()
。指定的演員表無效WebBroswer
public void moreInfo()
{
HtmlElement newElement = webBrowser.Document.GetElementById("order_billing_name");
newElement.InnerText = nameBox.ToString();
newElement = webBrowser.Document.GetElementById("order_email");
newElement.InnerText = emailBox.ToString();
newElement = webBrowser.Document.GetElementById("order_tel");
newElement.InnerText = telephoneBox.ToString();
newElement = webBrowser.Document.GetElementById("order_billing_address");
newElement.InnerText = addressBox.ToString();
newElement = webBrowser.Document.GetElementById("order_billing_zip");
newElement.InnerText = zipBox.ToString();
newElement = webBrowser.Document.GetElementById("order_billing_city");
newElement.InnerText = cityBox.ToString();
newElement = webBrowser.Document.GetElementById("order_billing_state");
newElement.SetAttribute("value", stateBox.ToString());
newElement = webBrowser.Document.GetElementById("order_billing_country");
newElement.SetAttribute("value", countryBox.ToString());
}
什麼是'nameBox'? –
這是我的Windows窗體應用程序上的文本框。 –