Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2007

Tip: Looking for answers? Try searching our database.

Using Web Browser COM control in C#

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
johnguilbert@cwgsy.net - 27 Jul 2007 15:40 GMT
HI,

Really apreciated if someone could help.

I am trying to automate a number of clicks etc for a web site that has
been developed. However, this site has a number of frames in it. The
frame id = "header"contains a login I need to auto-populate. However
the syntax I am trying is not correct. How do I access a frame's html
from the main (base) document?

I have:

// retrieve base document
HTMLDocument myDoc = new HTMLDocumentClass();
myDoc = (HTMLDocument) axWebBrowser1.Document;

// this line is incorrect - it doesn't like this syntax
HTMLFrameElement otxtloginframe =  (HTMLFrameElement)
myDoc.frames("header");

// retrieve document in frame 'header'
HTMLDocument myDoc2 = new HTMLDocumentClass();
myDoc2 = (HTMLDocument) otxtloginframe.document;

Any help really appreciated.

Thanks

John.
John Saunders [MVP] - 27 Jul 2007 18:32 GMT
> HI,
>
[quoted text clipped - 10 lines]
> // retrieve base document
> HTMLDocument myDoc = new HTMLDocumentClass();

Don't use "new" here. You're creating a document just to destroy it in the
next line of code.

> myDoc = (HTMLDocument) axWebBrowser1.Document;
>
> // this line is incorrect - it doesn't like this syntax
> HTMLFrameElement otxtloginframe =  (HTMLFrameElement)
> myDoc.frames("header");

This probably wants to be:

myDoc.frames["header"];

However, I can't be sure, since you didn't include the error you received.

BTW, which version of .NET are you using? There's a managed web browser
control in .NET 2.0.
Signature

John Saunders [MVP]


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.