473,395 Members | 1,577 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Problem with GetType().InvokeMember

Hi,

I have a object which is created by using the Assembly.CreateInstance
method.

Assembly testAss = Assembly.LoadWithPartialName("Test");
object obj = testAss.CreateInstance("Sample1.SampleTest");
//This obj is the instance of SampleTest Class

Upto this the cod is working fine.

When i try to invoke one method of the SampleTest Class with obj its
giving the result object Undefined Value.

This is my code.
object[] Parameters = new object[2];
Parameters[0] = methodName;//It is string
Parameters[1] = clientReqAL;//clientReqAL is the ArrayList Containing
Two Values(string).
if(wrapperInst!=null)
{
object result = obj.GetType().InvokeMember("TestMethod",
BindingFlags.InvokeMethod,null,obj,Parameters);
}

How can i solve this problem .If anybody knows the solution let me
know.

Thanks,
Vinoth

Nov 17 '05 #1
2 8165
vi****@gsdindia.com wrote:
object result = obj.GetType().InvokeMember("TestMethod",
BindingFlags.InvokeMethod,null,obj,Parameters);


You'll have to make this

BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.Public

assuming your method is an instance method (which I'm quite sure of from
your description) and it's public (otherwise, replace the Public flag by
NonPublic).

Hope this helps!
Oliver Sturm
--
omnibus ex nihilo ducendis sufficit unum
Spaces inserted to prevent google email destruction:
MSN oliver @ sturmnet.org Jabber sturm @ amessage.de
ICQ 27142619 http://www.sturmnet.org/blog
Nov 17 '05 #2
vi****@gsdindia.com wrote:
object result = obj.GetType().InvokeMember("TestMethod",
BindingFlags.InvokeMethod,null,obj,Parameters);


You'll have to make this

BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.Public

assuming your method is an instance method (which I'm quite sure of from
your description) and it's public (otherwise, replace the Public flag by
NonPublic).

Hope this helps!
Oliver Sturm
--
omnibus ex nihilo ducendis sufficit unum
Spaces inserted to prevent google email destruction:
MSN oliver @ sturmnet.org Jabber sturm @ amessage.de
ICQ 27142619 http://www.sturmnet.org/blog
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Diego Valencia | last post by:
The attach error was generate when I tried to use invoke method "setpassword" this is mi code objeto.Invoke("SetPassword", new object {contraseƱa}); The error is "The filename, directory...
1
by: Matthias Pieroth | last post by:
Hi NG, I have an OCX (VC++ 6.0) that fires some events. I have to use it on a form an have to catch the events in event-handlers in another form (MDI-Child). BUT: I have to create the other...
0
by: vinoth | last post by:
Hi, I have a object which is created by using the Assembly.CreateInstance method. Assembly testAss = Assembly.LoadWithPartialName("Test"); object obj =...
0
by: Pat Ireland | last post by:
I continue to investigate issues with making explicit InvokeMember calls (necessary when dynamically loading classes). My quest lets me use a simple class to invoke another class's member method...
1
by: Raveendra M | last post by:
Hi! I am working with ASP.NET application. In my page I am creating one Application Domain and in that domain I am calling my DLL. Using the methods of the dll. And unloading the Application...
7
by: Denis Samoilov | last post by:
We have a namespace N which includes enumeration ENUM1 and a class C with property C.Enum1, e.g. namespace N { public enum ENUM1{}; public class C { public ENUM1 Enum1 { get{} set{}
1
by: Udi | last post by:
Hi All, I have a function that I need to call on reflection that has an out parameter (maybe more than one). My problem is that I'm not receiving the out values. The following code works fine...
2
by: =?Utf-8?B?UmVuYXVkIExhbmdpcw==?= | last post by:
Hello, I have an asp.net web page (say page.aspx) which derives from a custom base page object (CustomPage : BasePage : System.Web.UI.Page) Which has a method called DoSomething(params). My web...
1
by: tommyk | last post by:
I am writing a small program that reads a text file filled with a large number of IP addresses and attempts to add them to IIS so that they will be blocked. For some reason, about one in every...
0
by: Jason Huang | last post by:
Hi, In my C# windows form project, I was trying to call a Excel macro. However, the GetType().InvokeMember was confusing me. Would some give me some easy sample to tell me what it is? Thanks...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.