Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27201

VS 2010 [RESOLVED] Object Reference not set to an instance of an object

$
0
0
I am getting the error message as the title shows when I try to insert user input into a web page form, please disregard the comment under line 8.

NOTE: The error will be in line 7 "Dim job As HtmlElement = Me.WebBrowser1.Document.All.Item("JobName")"


Code:

Public Class Form1

    Private Sub Submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Submit.Click
        WebBrowser1.Navigate("http:///TEST/")
        With WebBrowser1
            Dim job As HtmlElement = Me.WebBrowser1.Document.All.Item("JobName")
            job.InnerText = TextBox1.Text
            ' .Document.GetElementById("Job").SetAttribute("Value", TextBox1.Text)
        End With
    End Sub

    Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted

    End Sub
End Class


Viewing all articles
Browse latest Browse all 27201

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>