C# 单击按钮时显示消息
我的表单中有一个名为C# 单击按钮时显示消息,c#,vb.net,button,browser,webbrowser-control,C#,Vb.net,Button,Browser,Webbrowser Control,我的表单中有一个名为WebBrowser1的webBrowser控件。 我使用以下代码将值拉入复选框和其他控件: WebBrowser1.Document.GetElementById("LastName").SetAttribute("value", "MyLastname")'<--- pull value to the textbox WebBrowser1.Document.GetElementById("TermsOfService").SetAttribute("value
WebBrowser1
的webBrowser控件。
我使用以下代码将值拉入复选框和其他控件:
WebBrowser1.Document.GetElementById("LastName").SetAttribute("value", "MyLastname")'<--- pull value to the textbox
WebBrowser1.Document.GetElementById("TermsOfService").SetAttribute("value", "yes")'<--- change the value of a check box
WebBrowser1.Document.GetElementById(“LastName”).SetAttribute(“value”,“MyLastname”)”您可以向要监视的按钮添加一个处理程序,例如,我在webbrowser控件的DocumentCompleted事件触发后添加了一个处理程序
Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
Dim htmlBtn As HtmlElement = WebBrowser1.Document.GetElementById("BtnID")
If htmlBtn IsNot Nothing Then
AddHandler htmlBtn.click, AddressOf YourSub
End If
End Sub
Private Sub YourSub()
messagebox.show("clicked!")
End Sub