CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 5/24/2005 12:14:11 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 1 Views: 39 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
2 Items, 1 Pages 1 |< << Go >> >|
emagine
Asp.Net User
myProblem = LoadControl + InvokeMember5/24/2005 12:14:11 PM

0/0

I have build a simple user control that implements an interface.
In my page, I use the LoadControl method to load the control dynamically :

      dim myControl as IMyInterface
      myControl = CType(Page.LoadControl(<path>\MyControl.ascx), IMyInterface)

The control is loaded without a problem and I could now execute the MyFunction method (as defined in the interface, see below) of the control like this :

      myControl.MyFunction()

All this is no problem.

But I created this test control to test the InvokeMember method.  Instead of calling MyFunction directly, I want to call it using the InvokeMember method :

myControl.GetType().InvokeMember("MyFunction", BindingFlags.InvokeMethod, Nothing, myControl, Nothing)

This always returns : "method not found".  How come ?  What am I doing wrong here ?

Thx,
Dave

.ascx file

<%@ Control Language="vb" AutoEventWireup="false" CodeFile="MyControl.ascx.vb" Inherits="MyControl" %>

.ascx.vb file

Partial Public Class MyControl
      Inherits System.Web.UI.UserControl
      Implements IMyInterface

      Public Function MyFunction() As Boolean Implements IMyInterface.MyFunction
            return true
      End Function
End
Class

interface file

Public Interface IMyInterface
      Function MyFunction()
      End Function
End Interface

 

 

hlaford
Asp.Net User
Re: myProblem = LoadControl + InvokeMember5/24/2005 6:15:05 PM

0/0

you'll probably have to specify more binding flags.  i can't remember what the default flags are, but i'm sure that's your problem.
2 Items, 1 Pages 1 |< << Go >> >|


Free Download:





Search This Site:










looking for a quick method to develop good looking prof. web apps.

new dnn 3 skins

determine selected item in dropdownlist from database

remote server and web site admin tool

shared methods, shared members and session

.net 2003 - .net 2005 beta produces different result for same code.

failed to access iis metabase

.aspx page not displaying correctly in alternate browsers

where does microsoft support web application projects in the 'guidance automation toolkit' or extensions?

guestbook spam problem

a little problem

missing image for container visibility set to "none"

10e-announcement module change

javascript - masterpage - help

hello again! can anyone answer this? thx in advance!

3.2.1 ad authentication: authentication settings are disabled

can't access remotely [:'(]

getting an error in a vs2003 web app

securing files in an asp.net application

insert query

 
All Times Are GMT