webbrowser System.IO.FileNotFoundException

  • Thread starter Thread starter Boki
  • Start date Start date
B

Boki

Hi All,

I am using webbrowser control, it is very often to happen:

A first chance exception of type 'System.IO.FileNotFoundException'
occurred in System.Windows.Forms.dll

but sometimes works, all the same code, what's the problem...and how to
resolve it...

Thank you very much.

Best regards,
Boki.
 
Boki,

Is this when you are debugging, running, or whatever.

Can you show us the code where this happens?

Cor
 
Cor Ligthert [MVP] 寫é“:
Boki,

Is this when you are debugging, running, or whatever.

Can you show us the code where this happens?

Cor

sure, please reference below
=============
Public Class Form1
Private mouseOffset As Point
Private isMouseDown As Boolean = False

Private Sub Form1_GotFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.GotFocus
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.Fixed3D
End Sub

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

End Sub

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

WebBrowser2.Navigate("http://mis.tse.com.tw/Quotes/Best5?Refresh=0&StkNo=2392")

Dim pos As Integer
pos = InStr(WebBrowser1.DocumentText, "C)", CompareMethod.Text)
Label1.Text = "T:" & Mid(WebBrowser1.DocumentText, pos + 65, 4)

pos = InStr(WebBrowser1.DocumentText, "(%)",
CompareMethod.Text)
Label2.Text = "H:" & Mid(WebBrowser1.DocumentText, pos + 66, 3)

Label4.Text = Mid$(TimeOfDay(), 4, 9)

End Sub

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

' Label1.Text = "Auto updating..."
End Sub


Private Sub WebBrowser2_DocumentCompleted(ByVal sender As Object,
ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs)
Handles WebBrowser2.DocumentCompleted
'-----stock information
Dim pos As Integer
pos = InStr(WebBrowser2.DocumentText, "MatchPrice",
CompareMethod.Text)
Label5.Text = "S: " & Mid(WebBrowser2.DocumentText, pos + 12,
5)

End Sub

Private Sub UpdateInfo()


WebBrowser1.Navigate("http://www.cwb.gov.tw/V5/observe/real/real_data_46692..htm")


End Sub

Private Sub Form1_LostFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.LostFocus
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
End Sub


Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As
MouseEventArgs) Handles MyBase.MouseUp
If e.Button = Windows.Forms.MouseButtons.Right Then
UpdateInfo()
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Window.open("www.kimo.com.tw")
End Sub
End Class
 
Boki,

Why do you not set the 2 or more webbrowsers in a Tabpage or a
splitcontainer. No problem as all.

I hope this helps,

Cor


"Boki" <[email protected]> schreef in bericht

Cor Ligthert [MVP] ??:
Boki,

Is this when you are debugging, running, or whatever.

Can you show us the code where this happens?

Cor

sure, please reference below
=============
Public Class Form1
Private mouseOffset As Point
Private isMouseDown As Boolean = False

Private Sub Form1_GotFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.GotFocus
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.Fixed3D
End Sub

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

End Sub

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

WebBrowser2.Navigate("http://mis.tse.com.tw/Quotes/Best5?Refresh=0&StkNo=2392")

Dim pos As Integer
pos = InStr(WebBrowser1.DocumentText, "C)", CompareMethod.Text)
Label1.Text = "T:" & Mid(WebBrowser1.DocumentText, pos + 65, 4)

pos = InStr(WebBrowser1.DocumentText, "(%)",
CompareMethod.Text)
Label2.Text = "H:" & Mid(WebBrowser1.DocumentText, pos + 66, 3)

Label4.Text = Mid$(TimeOfDay(), 4, 9)

End Sub

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

' Label1.Text = "Auto updating..."
End Sub


Private Sub WebBrowser2_DocumentCompleted(ByVal sender As Object,
ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs)
Handles WebBrowser2.DocumentCompleted
'-----stock information
Dim pos As Integer
pos = InStr(WebBrowser2.DocumentText, "MatchPrice",
CompareMethod.Text)
Label5.Text = "S: " & Mid(WebBrowser2.DocumentText, pos + 12,
5)

End Sub

Private Sub UpdateInfo()


WebBrowser1.Navigate("http://www.cwb.gov.tw/V5/observe/real/real_data_46692.htm")


End Sub

Private Sub Form1_LostFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.LostFocus
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
End Sub


Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As
MouseEventArgs) Handles MyBase.MouseUp
If e.Button = Windows.Forms.MouseButtons.Right Then
UpdateInfo()
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Window.open("www.kimo.com.tw")
End Sub
End Class
 
Cor Ligthert [MVP] 寫é“:
Boki,

Why do you not set the 2 or more webbrowsers in a Tabpage or a
splitcontainer. No problem as all.

I hope this helps,

Cor


"Boki" <[email protected]> schreef in bericht

Cor Ligthert [MVP] ??:


sure, please reference below
=============
Public Class Form1
Private mouseOffset As Point
Private isMouseDown As Boolean = False

Private Sub Form1_GotFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.GotFocus
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.Fixed3D
End Sub

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

End Sub

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

WebBrowser2.Navigate("http://mis.tse.com.tw/Quotes/Best5?Refresh=0&StkNo=2392")

Dim pos As Integer
pos = InStr(WebBrowser1.DocumentText, "C)", CompareMethod.Text)
Label1.Text = "T:" & Mid(WebBrowser1.DocumentText, pos + 65, 4)

pos = InStr(WebBrowser1.DocumentText, "(%)",
CompareMethod.Text)
Label2.Text = "H:" & Mid(WebBrowser1.DocumentText, pos + 66, 3)

Label4.Text = Mid$(TimeOfDay(), 4, 9)

End Sub

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

' Label1.Text = "Auto updating..."
End Sub


Private Sub WebBrowser2_DocumentCompleted(ByVal sender As Object,
ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs)
Handles WebBrowser2.DocumentCompleted
'-----stock information
Dim pos As Integer
pos = InStr(WebBrowser2.DocumentText, "MatchPrice",
CompareMethod.Text)
Label5.Text = "S: " & Mid(WebBrowser2.DocumentText, pos + 12,
5)

End Sub

Private Sub UpdateInfo()


WebBrowser1.Navigate("http://www.cwb.gov.tw/V5/observe/real/real_data_46692.htm")


End Sub

Private Sub Form1_LostFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.LostFocus
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
End Sub


Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As
MouseEventArgs) Handles MyBase.MouseUp
If e.Button = Windows.Forms.MouseButtons.Right Then
UpdateInfo()
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Window.open("www.kimo.com.tw")
End Sub
End Class


because I don't know how to do that..><.....
could you please advice?
 
Boki,

Just drag a tabcontrol on your form
Drag in the tabpages the same as you did it now on the form, not so much to
learn.

Problem is that it is more dragging than code. Therefore I cannot even give
you a sample.

Cor

"Boki" <[email protected]> schreef in bericht

Cor Ligthert [MVP] ??:
Boki,

Why do you not set the 2 or more webbrowsers in a Tabpage or a
splitcontainer. No problem as all.

I hope this helps,

Cor


"Boki" <[email protected]> schreef in bericht

Cor Ligthert [MVP] ??:


sure, please reference below
=============
Public Class Form1
Private mouseOffset As Point
Private isMouseDown As Boolean = False

Private Sub Form1_GotFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.GotFocus
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.Fixed3D
End Sub

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

End Sub

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

WebBrowser2.Navigate("http://mis.tse.com.tw/Quotes/Best5?Refresh=0&StkNo=2392")

Dim pos As Integer
pos = InStr(WebBrowser1.DocumentText, "C)", CompareMethod.Text)
Label1.Text = "T:" & Mid(WebBrowser1.DocumentText, pos + 65, 4)

pos = InStr(WebBrowser1.DocumentText, "(%)",
CompareMethod.Text)
Label2.Text = "H:" & Mid(WebBrowser1.DocumentText, pos + 66, 3)

Label4.Text = Mid$(TimeOfDay(), 4, 9)

End Sub

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

' Label1.Text = "Auto updating..."
End Sub


Private Sub WebBrowser2_DocumentCompleted(ByVal sender As Object,
ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs)
Handles WebBrowser2.DocumentCompleted
'-----stock information
Dim pos As Integer
pos = InStr(WebBrowser2.DocumentText, "MatchPrice",
CompareMethod.Text)
Label5.Text = "S: " & Mid(WebBrowser2.DocumentText, pos + 12,
5)

End Sub

Private Sub UpdateInfo()


WebBrowser1.Navigate("http://www.cwb.gov.tw/V5/observe/real/real_data_46692.htm")


End Sub

Private Sub Form1_LostFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.LostFocus
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
End Sub


Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As
MouseEventArgs) Handles MyBase.MouseUp
If e.Button = Windows.Forms.MouseButtons.Right Then
UpdateInfo()
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Window.open("www.kimo.com.tw")
End Sub
End Class


because I don't know how to do that..><.....
could you please advice?
 
Back
Top