sheenitmathew
Member
- Joined
- Feb 4, 2013
- Messages
- 9
- Programming Experience
- 5-10
Dears
I want to develop a desktop application to fill the fields in a web form. I could do this using the .NET frame work 3, but when the platform is changed to 4.0, then it generates error. I cannot change the framework since I use some function that does not exist in 3 (such as String.IsNullOrWhiteSpace). My code follows.
Private Sub frmWebBrowser_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
WebBrowser1.Navigate("mylink.....")
End Sub
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
Dim element As HtmlElement = WebBrowser1.Document.GetElementById("forwardbtn2")
If Not element Is Nothing Then
element.All("forwardbtn2").InvokeMember("click") 'I want to click a button programatically. This works fine in frame work 3, but generates error in framework 4: Object reference not set to an instance of an object.
Else
MessageBox.Show("Check your internet connection", "Erroe", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
End Sub
Please help me solve this issue. I also want to use the GetAttribute() and SetAttribute() functions to get and set values on the web form. Thanks in advance for your help.
I want to develop a desktop application to fill the fields in a web form. I could do this using the .NET frame work 3, but when the platform is changed to 4.0, then it generates error. I cannot change the framework since I use some function that does not exist in 3 (such as String.IsNullOrWhiteSpace). My code follows.
Private Sub frmWebBrowser_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
WebBrowser1.Navigate("mylink.....")
End Sub
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
Dim element As HtmlElement = WebBrowser1.Document.GetElementById("forwardbtn2")
If Not element Is Nothing Then
element.All("forwardbtn2").InvokeMember("click") 'I want to click a button programatically. This works fine in frame work 3, but generates error in framework 4: Object reference not set to an instance of an object.
Else
MessageBox.Show("Check your internet connection", "Erroe", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
End Sub
Please help me solve this issue. I also want to use the GetAttribute() and SetAttribute() functions to get and set values on the web form. Thanks in advance for your help.