Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Embedded HTML

Status
Not open for further replies.

bont

Programmer
Sep 7, 2000
200
US
I wanted to build a generic form which does nothing but display a Microsoft Web Browser. I did this using the Active X Reference (Let me know if there is a better way in VB.net).

My problem was that I pass 2 params during creation of the form object, the form title and the URL to load. I tried to load the single AX control in the NEW and the LOAD routines; however, it appeared to hang.

I then realized the process' outcome (window refresh) was not being caught as neither the Load or NEW routines waited for the AX return.

I fixed this by starting a thread:
Code:
    Private Sub frm_DisplayHTML_Load(ByVal sender As _
            System.Object, ByVal e As System.EventArgs) _
              Handles MyBase.Load
        Dim t As Thread
        t = New Thread(AddressOf Me.LoadFile)
        t.Start()
        frmMain.Refresh()
    End Sub

    Private Sub LoadFile()
        Dim nullObject As System.Object = 0
        Dim str As String = ""
        Dim nullObjStr As System.Object = str
        Cursor.Current = Cursors.WaitCursor
        axIE.Navigate("file://" & HTMLFile, nullObject, _
               nullObjStr, nullObjStr, nullObjStr)
        Cursor.Current = Cursors.Default
    End Sub

The only other change was to refresh the main form as the drawing is corrupted a little after the secondary thread is terminated.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top