Automating IE from WinForm

Seeker

New member
Joined
Feb 24, 2004
Messages
1
Location
Near the Snow
Im trying to automate an IE instance from within a Windows Form. I can quite happily load IE and navigate to the page that I need using SHDocVw.InternetExplorerClass.Navigate but I have not been able to get my program to post data onto the page. I have tried using the Write function of the IHTMLDocument2 object but that has just caused an abend in the application. Here is the code that I have been using:

//
// Invoke IE Explorer and navigate to the startup page.
//
objNav = new SHDocVw.InternetExplorerClass();
objNav.Navigate("http://test/CTest", ref objTemp,
ref objTemp, ref objTemp, ref objTemp);
objNav.Visible = true;
//
// Obtain a reference to the document and then try and influence
// the fields.
//
string[] myarray = new string[1] {"Admin"};
mshtml.IHTMLDocument2 objDoc = (mshtml.IHTMLDocument2) objNav.Document;
mshtml.IHTMLElementCollection objAnchors = objDoc.anchors;
objDoc.write(myarray);
//

Has anybody done something like this or have a code fragment that does this?
 
Back
Top