2013-12-21 45 views
0

我正在使用Visual Basic 2008.我去發佈我的項目,並且我得到兩個「表達期望」錯誤。我對Visual Basic很陌生 - 我昨晚纔開始。代碼:Visual Basic中的兩個「預期表達式」錯誤

Public Class Form1 

Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) 
    WebBrowser1.Navigate("www.zudostudios.com") 
End Sub 

Private Sub GoBtn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 
    WebBrowser1.Navigate(addressTxt.Text) 
End Sub 

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 

End Sub 

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addressTxt.TextChanged 

End Sub 

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click 
    TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addressTxt.TextChanged 
End Sub 

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) 

End Sub 

Private Sub Button3_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click 
    WebBrowser1.Navigate("www.zudostudios.com") 
End Sub 

Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)  Handles Label1.Click 

End Sub 
End Class 

回答

1

這是一個複製粘貼錯誤。

您已經實現了以下代碼。

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click 
    TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addressTxt.TextChanged 
End Sub 

但調用的方法時TextBox1_TextChangedHandles addressTxt.TextChanged是沒用的。

正確的代碼應該是:

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click 
    TextBox1_TextChanged(sender, e) 
End Sub 
+0

我嘗試了新的代碼。我仍然得到2個表達預期的錯誤。每個人都把我帶到代碼中的「ByVals」的oe。 – user3003189

+0

@ user3003189,固定代碼..沒有試過。 –

+0

謝謝 - 雖然沒有想到,我想出瞭如何做一個WebBrowser1.refresh()或不管它。它現在的作品,謝謝:) – user3003189