|
-
February 19th, 2007, 03:02 PM
#1
[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
Last edited by jss3426; February 19th, 2007 at 08:56 PM.
Reason: [SOLVED]
-
February 19th, 2007, 03:11 PM
#2
Re: another embarsassing ?
Did you try...
IMain mainInterface = myusercontrolvariable as IMain; ???
-
February 19th, 2007, 05:05 PM
#3
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...
-
February 19th, 2007, 08:39 PM
#4
Re: another embarsassing ?
Join the fight, refuse to respond to posts that contain code outside of [ code ] tags
Kenneth Jones, .Net Framework BCL/CLR Guru
Join the fight, refuse to respond to posts that contain code outside of [ code ] tags
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|