Happy New Year Winguy:
You have written the code to set the value of a text, but, have you
discovered
how to set & retrieve the values of Check boxes, and Select Options?
Thanks.
From: WinGuy (no_spam@nomail.bot)
Subject: Communicating Between VB6 and a HTML Document
View this article only
Newsgroups: microsoft.public.scripting.vbscript
Date: 2004-12-28 12:26:03 PST
I had a need to manipulate the activities of a webpage hosted by the
WebBrowser control from within a Visual Basic project. The requirement was
that VB must be able to communicate with VBScript, and vice versa. This is
how I accomplished the task.
I created a new Visual Basic project and placed the WebBrowser control on
its default form. I initially set that control properties with a name of
WebBrowser1, and as not visible. I placed a command button on top of the
WebBrowser1 control, right-clicked it and sent it to the front and then
right-clicked the WebBrowser1 control and sent it to the back. I set the
form properties to not display a menu bar.
I set the click event handler for the command button to end the program. In
the form unload event is where I destroyed all objects before the VB program
would end.
This code would set the form to entirely fill a 1024x768 screen:
Me.Move 0, 0
Me.Width = 15360: Me.Height = 11520
Me.Visible = True
This code would then initialize that control for full screen and no taskbar
or menus:
WebBrowser1.Left = 10: WebBrowser1.Top = 10
WebBrowser1.Height = Me.Height - 20: WebBrowser1.Width = Me.Width - 20
WebBrowser1.AddressBar = False
WebBrowser1.MenuBar = False
WebBrowser1.StatusBar = False
WebBrowser1.FullScreen = True
WebBrowser1.TheaterMode = True
WebBrowser1.GoHome
WebBrowser1.Visible = True
I defined a global variable named PageReady. Then this code in
WebBrowser1.DocumentComplete:
PageReady = True
Then I created Sub MyTest() and placed this code into it:
WebBrowser1.Navigate MyPath & "Page1.html" 'MyPath is previously defined
PageReady = False
While PageReady = False: DoEvents: DoEvents: DoEvents: Wend 'Page loaded
'Set the text value in the page control named txtWebBrowser!
WebBrowser1.Document.All.Item("txtWebBrowser").Value = "Message from VB6
Code!"
'Get the text value in the page control named txtWebBrowser!
'MsgBox WebBrowser1.Document.All.Item("txtWebBrowser").Value
----------------
That completes the VB part. I then created a webpage called Page1.html,Read
the rest of this message... (43 more lines)
Post a follow-up to this message