Hi,
I am trying to write a program that will control internet explorer as part of another program but I am writing this part first. I got a sample code from online but I am missing a using directive? Here are the errors that I got when I compiled the program.
error CS0246: The type or namespace name 'InternetExplorer' could not be found (are you missing a using directive or an assembly reference?)
error CS0103: The name 'NSLibStatic' does not exist in the current context
This is the code that I ran.
using System;
using System.Collections.Generic;
using System.Text;
namespace IECONNECTION
{
class Program
{
public static bool IEOpenOnURL(string sURL)
{
InternetExplorer oIE = (InternetExplorer)NSLibStatic.COMCreateObject
("InternetExplorer.Application");
if (oIE != null)
{
object oEmpty = String.Empty;
object oURL = sURL;
oIE.Visible = false;
oIE.Navigate2(ref oURL, ref oEmpty, ref oEmpty, ref oEmpty, ref oEmpty);
}
return true;
}
static void Main(string[] args)
{
}
}
}
Enter your message below
Sign in or Join us (it's free).