Hello I am writing code in VB6 only (no VB.NET)
I have webbrowsercontrol object named webbrowser1 I have added reference of microsoft html object library in project.
I am trying this line but is giving error.
Dim doc as MSHTML.HTMLDocument
doc = DirectCast(webbrowser1.document, MSHTML.HTMLDocument)
line 2 is giving error that no method or data found at MSHTML.HTMLDocument Please help me solving this problem.
What I want is I have one webpage having 2 (html forms) in it. I am loading that page into webbrowser control by,
webbrowser1.navigate "url"
I have mapped event to handle html button click in webbrowser1's document. When user clicks on this button I want to submit second form of html page. Is there any other way to do it?
I also tried following code
'this line is working properly
'this is the code to submit first form in html page
webbrowser1.document.Forms(0).submit
but when I do
'this line is giving error though there are 2 forms available in html page
webbrowser1.document.Forms(1).submit
So ultimate goal is to submit second form of html document. Please show me right direction.
Have you tried just direct assignment?
Dim doc as MSHTML.HTMLDocument
Set doc = webbrowser1.document
VB6 doesn't really do casting, but you can access any method (early bound) by assigning it to an variable of the required type, or (late bound) by blindly using a variable of Object
type.