Home All Groups Group Topic Archive Search About

webbrowser System.IO.FileNotFoundException

Author
19 Apr 2006 2:28 AM
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.

Author
19 Apr 2006 5:20 AM
Cor Ligthert [MVP]
Boki,

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

Can you show us the code where this happens?

Cor

Show quoteHide quote
"Boki" <bokit***@ms21.hinet.net> schreef in bericht
news:1145413714.001892.68770@z34g2000cwc.googlegroups.com...
> 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.
>
Author
19 Apr 2006 5:38 AM
Boki
Cor Ligthert [MVP] 寫道:

Show quoteHide quote
> Boki,
>
> Is this when you are debugging, running, or whatever.
>
> Can you show us the code where this happens?
>
> Cor
>
> "Boki" <bokit***@ms21.hinet.net> schreef in bericht
> news:1145413714.001892.68770@z34g2000cwc.googlegroups.com...
> > 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.
> >

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
Author
19 Apr 2006 7:07 AM
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" <bokit***@ms21.hinet.net> schreef in bericht
news:1145425118.314664.281620@t31g2000cwb.googlegroups.com...

Cor Ligthert [MVP] ??:

Show quoteHide quote
> Boki,
>
> Is this when you are debugging, running, or whatever.
>
> Can you show us the code where this happens?
>
> Cor
>
> "Boki" <bokit***@ms21.hinet.net> schreef in bericht
> news:1145413714.001892.68770@z34g2000cwc.googlegroups.com...
> > 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.
> >

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
Author
19 Apr 2006 8:05 AM
Boki
Cor Ligthert [MVP] 寫道:

Show quoteHide quote
> 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" <bokit***@ms21.hinet.net> schreef in bericht
> news:1145425118.314664.281620@t31g2000cwb.googlegroups.com...
>
> Cor Ligthert [MVP] ??:
>
> > Boki,
> >
> > Is this when you are debugging, running, or whatever.
> >
> > Can you show us the code where this happens?
> >
> > Cor
> >
> > "Boki" <bokit***@ms21.hinet.net> schreef in bericht
> > news:1145413714.001892.68770@z34g2000cwc.googlegroups.com...
> > > 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.
> > >
>
> 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?
Author
19 Apr 2006 10:47 AM
Cor Ligthert [MVP]
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" <bokit***@ms21.hinet.net> schreef in bericht
news:1145433903.726811.4130@t31g2000cwb.googlegroups.com...

Cor Ligthert [MVP] ??:

Show quoteHide quote
> 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" <bokit***@ms21.hinet.net> schreef in bericht
> news:1145425118.314664.281620@t31g2000cwb.googlegroups.com...
>
> Cor Ligthert [MVP] ??:
>
> > Boki,
> >
> > Is this when you are debugging, running, or whatever.
> >
> > Can you show us the code where this happens?
> >
> > Cor
> >
> > "Boki" <bokit***@ms21.hinet.net> schreef in bericht
> > news:1145413714.001892.68770@z34g2000cwc.googlegroups.com...
> > > 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.
> > >
>
> 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?