I can see this being a simple correction however it has me stumped.
This is the error I am getting
COMException was unhandled
Error HRESULT E_FAIL has been returned from a call to a COM component.
This is the code (I have blanked out the URL however they are valid)
class SMSHandler
{
private InternetExplorer ie;
private object URL = "##########";
private object URL2 = "###########";
public SMSHandler()
{
ie = new InternetExplorer();
ie.Visible = true;
}
public void openMACS()
{
object Empty = 0;
ie.Navigate2(ref URL, ref Empty, ref Empty, ref Empty, ref Empty);
while (ie.Busy);
ie.Navigate2(ref URL2, ref Empty, ref Empty, ref Empty, ref Empty);
IHTMLDocument2 HTMLDoc = (IHTMLDocument2)ie.Document;
}
This is the line that is generating the error
IHTMLDocument2 HTMLDoc = (IHTMLDocument2)ie.Document;
The web page opens fine however when I try to assign the Document to the IHTMLDocument2 it fails.
Any help would be great