how to call ref object for interop browser control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have code like this:

SHDocVw.WebBrowserClass webCtl= new SHDocVw.WebBrowserClass();
object theURLobj;
string theURL="overview.htm";
theURLobj= (object)theURL;
object nullObj = null;
webCtl.Navigate2(theURLobj,nullObj,nullObj,nullObj,nullObj);
//GIVES ERROR :
Argument '1': cannot convert from 'object' to 'ref object'
.....
Argument '5': cannot convert from 'object' to 'ref object'

What does anyone suggest ! Thanks Andrew
 
You have to explicitly state "ref" in your call:

webCtl.Navigate2( ref theURLobj, ref nullObj ....
 
andrewcw said:
I have code like this:

SHDocVw.WebBrowserClass webCtl= new SHDocVw.WebBrowserClass();
object theURLobj;
string theURL="overview.htm";
theURLobj= (object)theURL;
object nullObj = null;
webCtl.Navigate2(theURLobj,nullObj,nullObj,nullObj,nullObj);
//GIVES ERROR :
Argument '1': cannot convert from 'object' to 'ref object'
...
Argument '5': cannot convert from 'object' to 'ref object'

What does anyone suggest ! Thanks Andrew

maybe this will help:

webCtl.Navigate2(ref theURLobj,nullObj,nullObj,nullObj,nullObj);


Vladimir.
 
Thanks I completely forgotten that the calling function must state 'ref' like it does for 'out'.
 
Back
Top