471,083 Members | 1,211 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,083 software developers and data experts.

Help: WebBrowser Control

Hi All,

I posted this in basic.visual.database 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.Navigate2 "about:blank"

----------------------------------------------------------------------------
------------------------------------------------
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><BODY BGCOLOR=#FFEEEE>"
Web1.MoveFirst
While Not Web1.EOF
HTMLText = HTMLText & "<FONT SIZE=4>" & Web1.Fields(BookNum).Value &
"</FONT>"
Web1.MoveNext
Wend
db.Close
HTMLText = HTMLText & "</BODY></HTML>"
WebBrowser1.Document.Script.Document.Clear
WebBrowser1.Document.Script.Document.Write HTMLText
WebBrowser1.Document.Script.Document.Close

End Sub

Thanks for any help!
Bill


Jul 17 '05 #1
1 8358
"Bill Kearns" <bk*****@goodnewsinteractive.com.no.spam> wrote in message news:<WH******************@newsread1.prod.itd.eart hlink.net>...
Hi All,

I posted this in basic.visual.database 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.Navigate2 "about:blank"

----------------------------------------------------------------------------
------------------------------------------------
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><BODY BGCOLOR=#FFEEEE>"
Web1.MoveFirst
While Not Web1.EOF
HTMLText = HTMLText & "<FONT SIZE=4>" & Web1.Fields(BookNum).Value &
"</FONT>"
Web1.MoveNext
Wend
db.Close
HTMLText = HTMLText & "</BODY></HTML>"
WebBrowser1.Document.Script.Document.Clear
WebBrowser1.Document.Script.Document.Write HTMLText
WebBrowser1.Document.Script.Document.Close

End Sub

Thanks for any help!
Bill


Try "refresh" method...
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Jim Hubbard | last post: by
9 posts views Thread by ASP .NET Newbie | last post: by
8 posts views Thread by Prosperz | last post: by
7 posts views Thread by smerf | last post: by
2 posts views Thread by jim | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.