Help: WebBrowser Control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bill Kearns

    Help: WebBrowser Control

    Hi All,

    I posted this in basic.visual.da tabase the other day and got no response.
    Hopiing someone here can help! Thanks!

    I found an article entitled "Add a Touch of Web to Your Windows
    Applications" on DevX.com and I'm trying to hone my skills. I've tried all 3
    tutorials and have had success on all but the one that teaches databound
    HTML on the fly. Everytime I execute my code, the WebBrowser control dies
    and goes blank when it reaches the point of opening the recordset. I was
    hoping you might help me out. Here is my VB6 code and my DB is an Access
    2000 database connected via ODBC.

    In General Declarations I have:
    Dim db As Connection
    Dim WithEvents Web1 As Recordset

    In the Form_Load() I have...
    WebBrowser1.Nav igate2 "about:blan k"

    ----------------------------------------------------------------------------
    ------------------------------------------------
    Private Sub LoadWeb1()
    Dim SQLWeb1 As String, TransTxt As String, BookTxt As String, Web1 As
    Recordset

    TransTxt = TranslationText .Text
    BookTxt = BookText.Text

    SQLWeb1 = "SELECT * FROM " & TransTxt & " WHERE Book = " & BookTxt & "
    ORDER BY Chapter;"
    Set Web1 = New Recordset
    Web1.Open SQLWeb1, db, adOpenStatic, adLockReadOnly

    Dim HTMLText As String
    HTMLText = "<HTML><BOD Y BGCOLOR=#FFEEEE >"
    Web1.MoveFirst
    While Not Web1.EOF
    HTMLText = HTMLText & "<FONT SIZE=4>" & Web1.Fields(Boo kNum).Value &
    "</FONT>"
    Web1.MoveNext
    Wend
    db.Close
    HTMLText = HTMLText & "</BODY></HTML>"
    WebBrowser1.Doc ument.Script.Do cument.Clear
    WebBrowser1.Doc ument.Script.Do cument.Write HTMLText
    WebBrowser1.Doc ument.Script.Do cument.Close

    End Sub

    Thanks for any help!
    Bill




  • Murat G.

    #2
    Re: Help: WebBrowser Control

    "Bill Kearns" <bkearns@goodne wsinteractive.c om.no.spam> wrote in message news:<WHNYa.264 6$M6.179383@new sread1.prod.itd .earthlink.net> ...[color=blue]
    > Hi All,
    >
    > I posted this in basic.visual.da tabase the other day and got no response.
    > Hopiing someone here can help! Thanks!
    >
    > I found an article entitled "Add a Touch of Web to Your Windows
    > Applications" on DevX.com and I'm trying to hone my skills. I've tried all 3
    > tutorials and have had success on all but the one that teaches databound
    > HTML on the fly. Everytime I execute my code, the WebBrowser control dies
    > and goes blank when it reaches the point of opening the recordset. I was
    > hoping you might help me out. Here is my VB6 code and my DB is an Access
    > 2000 database connected via ODBC.
    >
    > In General Declarations I have:
    > Dim db As Connection
    > Dim WithEvents Web1 As Recordset
    >
    > In the Form_Load() I have...
    > WebBrowser1.Nav igate2 "about:blan k"
    >
    > ----------------------------------------------------------------------------
    > ------------------------------------------------
    > Private Sub LoadWeb1()
    > Dim SQLWeb1 As String, TransTxt As String, BookTxt As String, Web1 As
    > Recordset
    >
    > TransTxt = TranslationText .Text
    > BookTxt = BookText.Text
    >
    > SQLWeb1 = "SELECT * FROM " & TransTxt & " WHERE Book = " & BookTxt & "
    > ORDER BY Chapter;"
    > Set Web1 = New Recordset
    > Web1.Open SQLWeb1, db, adOpenStatic, adLockReadOnly
    >
    > Dim HTMLText As String
    > HTMLText = "<HTML><BOD Y BGCOLOR=#FFEEEE >"
    > Web1.MoveFirst
    > While Not Web1.EOF
    > HTMLText = HTMLText & "<FONT SIZE=4>" & Web1.Fields(Boo kNum).Value &
    > "</FONT>"
    > Web1.MoveNext
    > Wend
    > db.Close
    > HTMLText = HTMLText & "</BODY></HTML>"
    > WebBrowser1.Doc ument.Script.Do cument.Clear
    > WebBrowser1.Doc ument.Script.Do cument.Write HTMLText
    > WebBrowser1.Doc ument.Script.Do cument.Close
    >
    > End Sub
    >
    > Thanks for any help!
    > Bill[/color]

    Try "refresh" method...

    Comment

    Working...