Vb.net 对象引用未设置为对象错误的实例?

Vb.net 对象引用未设置为对象错误的实例?,vb.net,Vb.net,每当我试图启动我的程序时,我都会遇到这个错误。这是我的密码: Imports System.IO Public Class Form1 Dim Passwords As New ArrayList Dim fileReader As String Dim WB As WebBrowser = Form2.WebBrowser1 Dim Username As String = ThirteenTextBox1.Text Private Sub Thir

每当我试图启动我的程序时,我都会遇到这个错误。这是我的密码:

Imports System.IO

Public Class Form1
    Dim Passwords As New ArrayList
    Dim fileReader As String
    Dim WB As WebBrowser = Form2.WebBrowser1
    Dim Username As String = ThirteenTextBox1.Text

    Private Sub ThirteenButton2_Click(sender As Object, e As EventArgs) Handles ClearButton.Click
        Passwords.Clear()
        NP.Text = Passwords.Count & " passwords loaded."
    End Sub

    Private Sub LoadButton_Click(sender As Object, e As EventArgs) Handles LoadButton.Click
        FileDialog.ShowDialog()
    End Sub

    Private Sub FileDialog_FileOk(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles FileDialog.FileOk
        Dim sr As New StreamReader(FileDialog.FileName)
        Do While sr.Peek >= 0
            Passwords.Add(sr.ReadLine())
            NP.Text = Passwords.Count & " passwords loaded."
        Loop
        sr.Close()
        sr.Dispose()
    End Sub

    Private Sub NP_Click(sender As Object, e As EventArgs) Handles NP.Click

    End Sub

    Private Sub ThirteenForm1_Click(sender As Object, e As EventArgs) Handles ThirteenForm1.Click

    End Sub

    Private Sub ThirteenButton5_Click(sender As Object, e As EventArgs) Handles ThirteenButton5.Click
        Form2.Visible = True
    End Sub

    Private Sub ThirteenButton4_Click(sender As Object, e As EventArgs) Handles ThirteenButton4.Click
        WB.Navigate("http://roblox.com/game/logout.aspx")
        Delay(4)
        WB.Navigate("https://www.roblox.com/Login/iFrameLogin.aspx")
        Delay(7)
        Dim UsernameField = WB.Document.GetElementById("UserName")
        Dim PasswordField = WB.Document.GetElementById("Password")
        Dim LoginButton = WB.Document.GetElementById("LoginButton")
        For Each Password As String In Passwords
            UsernameField.SetAttribute("Value", Username)
            PasswordField.SetAttribute("Value", Password)
            If WB.Document.GetElementById("recaptcha_challenge_image") IsNot Nothing Then
                Form3.Visible = True
                Console.WriteLine("Captcha detected!")
                Form3.PictureBox1.ImageLocation = WB.Document.GetElementById("recaptcha_challenge_image").GetAttribute("src")
                While Variables.Clicked = False
                    Application.DoEvents()
                End While
                Variables.Clicked = False
                Form3.PictureBox1.ImageLocation = ""
                WB.Document.GetElementById("recaptcha_response_field").SetAttribute("Value", Form3.ThirteenTextBox1.Text)
            End If
            LoginButton.InvokeMember("click")
            Delay(3)
            If UsernameField Is Nothing Then
                MessageBox.Show("Password is " & Password)
                Stop
            End If
        Next
    End Sub
End Class

我已经解决了这个问题,问题是我试图将Dim Username设置为String=TextBox1.Text。

这不是一个问题,只是一个错误转储。这不属于SO。我在问如何修复它。错误在哪一行?在xml文件中,当它设置默认表单时。可能的重复