[SOLVED]another embarsassing ?
i have a user control
defined an interface on it
Code:
public interface IMain
{
[DispId(1)]
int addsomething(int val1,int val2)
}
public class Main : IMain
{
public Main() { }
public int addsomething(int val1,int val2)
{
return(val1 + val2)
}
}
the conntrol builds.
now i place the control on my form/page. how do i get to the interfaces???
i know this is really simple but need to ask...as this is one of the rare times i work on wb controls...or windows controls...
[Resolution]
1. compiled my user control. it is called myusercontrol.dll
2. created new windows application in c#
3. loaded myusercontrol and its instance is called testingmyusercontrol
4. declared the following
public myusercontrol.usercotrol.IMain interfaceTest;
5. button on click event:
set interfacetest = new myusercontrol.usercontrol.main();
int result = interfacetest.addsomething(1,1)
BlackLazy: where would the 'code' button be? yea i now know that one can use the tags
Re: another embarsassing ?
Did you try...
IMain mainInterface = myusercontrolvariable as IMain; ???
Re: another embarsassing ?
poochi,
i did thitrying it on a windows app now
contrl = wincontrl
contrl name on form = mytestctrl [instance of wincontrl]
wincontrl.usercontrol.IMain iFaceTest = (wincontrl.usercontrl.Imain)mytestctrl;
of course this results in an error...
Re: another embarsassing ?
Join the fight, refuse to respond to posts that contain code outside of [ code ] tags :thumb: