-1
我在Visual是新的編程基礎2010年 我有這些錯誤:VB 2010「」類型的第一次機會異常出現在Microsoft.VisualBasic.dll中
A first chance exception of type 'System.InvalidCastException' occurred in Microsoft.VisualBasic.dll
這裏的我的代碼。
Public Class Form1
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If TextBox2.ReadOnly = True Then
TextBox2.ReadOnly = False
End If
End Sub
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If TextBox3.ReadOnly = False Then
TextBox3.ReadOnly = True
TextBox3.Text = "|n/a|"
End If
If TextBox2.ReadOnly = False Then
TextBox2.ReadOnly = True
End If
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
TextBox3.Text = "[1.5.2]"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If CheckBox1.Checked Then
Button1.Enabled = False
Threading.Thread.Sleep(500)
Button2.PerformClick()
Button3.PerformClick()
Button4.PerformClick()
Threading.Thread.Sleep(500)
If RichTextBox1.Text = Nothing Then
Threading.Thread.Sleep(5000)
Button3.PerformClick()
Button3.PerformClick()
Label4.Text = "Next try in 10 seconds"
Threading.Thread.Sleep(10000)
Label4.Text = "Trying...."
Button1.Enabled = True
Button1.PerformClick()
End If
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TabControl1.SelectedTab = TabPage2
Threading.Thread.Sleep(1000)
WebBrowser2.Navigate("https://login.minecraft.net?user=" + TextBox1.Text + "&password=" + TextBox2.Text + "&version=13")
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
RichTextBox1.Text = WebBrowser2.DocumentText
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
If WebBrowser2.DocumentText.Contains("Bad login") Then
MessageBox.Show("Bad login!")
End If
If WebBrowser2.DocumentText.Contains("User not premium") Then
MessageBox.Show("User not premium! Please buy Minecraft at the http://minecraft.net/ ")
End If
If RichTextBox1.Text.Contains("Bad login") Then
MessageBox.Show("Bad login!")
End If
If RichTextBox1.Text.Contains("User not premium") Then
MessageBox.Show("User not premium! Please buy Minecraft at the http://minecraft.net/ ")
End If
End Sub
End Class
你在哪裏得到這個例外?我的意思是,任何線路號碼。或方法? –
有兩件事Stackoverflow不是。代碼轉換器和代碼修復器。人們傾向於對「請將這些代碼轉換爲我」以及「我的代碼有什麼問題?」這樣的問題皺眉。話雖如此,我們通常會幫助人們提供他們最小的努力來研究他們的問題,然後再發布。在上面的例子中,對於錯誤肯定是#行,並且根據這一點,您可能還想包含周圍變量的狀態。在失敗的行上放置一個斷點,在調試器中檢查這些斷點,並將這些信息包含在您的問題中。 – Neolisk