我正在vb.net上创建一个应用程序,我正在使用Web浏览器。代码工作正常,但每次打开应用程序时都会出现一些弹出窗口。
这是弹出窗口:
如何删除此脚本错误。以下是我的代码:
Imports System.Text
Public Class Form4
Private Sub btnMapIt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMapIt.Click
Try
Dim street As String = String.Empty
Dim city As String = String.Empty
Dim state As String = String.Empty
Dim zip As String = String.Empty
Dim queryAddress As New StringBuilder()
queryAddress.Append("http://maps.google.com/maps?q=")
queryAddress.Append(TextBox1.Text)
webBrowser1.Navigate(queryAddress.ToString())
Catch ex As Exception
MessageBox.Show(ex.Message.ToString(), "Unable to Retrieve Map")
End Try
End Sub
Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
Try
TextBox1.Text = Form10.TextBox6.Text
'txtStreet.Text = TextBox1.Text
Catch ex As Exception
MsgBox("Welcome to Google Maps", MsgBoxStyle.Information)
End Try
End Sub
End Class
答案 0 :(得分:2)
在Form Load事件中尝试此操作,查看this property in doc:
webBrowser.ScriptErrorsSuppressed = true;