Questions tagged [invokemember]
46 questions
35
votes
4 answers
C# reflection - load assembly and invoke a method if it exists
I want to load an assembly (its name is stored in a string), use reflection to check if it has a method called "CustomType MyMethod(byte[] a, int b)" and call it or throw an exception otherwise. I guess I should do something like this, but would…

w128
- 4,680
- 7
- 42
- 65
3
votes
2 answers
MethodInfo.Invoke vs Type.InvokeMember?
What is the difference between the MethodInfo.Invoke() and Type.InvokeMember() methods?
Which should be used in which scenarios?
Which is the preferred way to invoke a method?

Fred
- 12,086
- 7
- 60
- 83
3
votes
1 answer
Using webbrowser to click on a button in a webpage
so what I need to do is to use this code:
WebBrowser browser = new WebBrowser();
browser.Navigate("www.somthing.com");
browser.Document.GetElementById("ID").InvokeMember("click");
and then i need to find the id of the button in the page and put in…

Porphan
- 153
- 4
- 11
3
votes
2 answers
How can I dynamically call a static method on a derived class
In my ASP.Net MVC pages I can click on column headers to sort by that column, but this involves "magic strings" in the aspx, which can result in runtime issues. I am trying to check at runtime whether the values passed to sort by are valid. I have…

BlackICE
- 8,816
- 3
- 53
- 91
2
votes
2 answers
Culture specific property in Excel via C# using InvokeMember
When we call the Excel object model via COM in C#, it always uses the en-US culture (this is a change that was made some years ago so that addins should work on all machines regardless of regional settings).
I would like to call the Excel object…

tjsmith
- 729
- 7
- 21
2
votes
2 answers
C# assign a value to the object property with parameters
I have an object in vbs:
Msgbox myobject.parametro("parm")
I can use it in C# in this way:
Object test = myobject.GetType().InvokeMember("parametro",
BindingFlags.GetProperty,
null,
myobject,
new object[] { "parm"…

Andrei Untu
- 21
- 1
2
votes
2 answers
Type.InvokeMember when method has a Dictionary parameter
I am getting a
Method 'MyNameSpace.MyClass.MyMethod' not found.
when I changed a parameter of MyMethod from Hashtable to Dictionary.
The invoke call is
return = t.InvokeMember("MyMethod", (BindingFlags.DeclaredOnly |…

Sam Leach
- 12,746
- 9
- 45
- 73
1
vote
1 answer
VB.Net Finding class ID to click when it's buried in the DOM
Example of the tree I'm dealing with
I am trying to click the 'followers' button on an IG account I run to see see the new users who have followed me automatically. (The example in the included picture is not my account for privacy reasons) I can…

user2261192
- 13
- 1
- 6
1
vote
1 answer
how i do perform click event using c# in webBrowser
How I do perform click event using c# in webBrowser.
This command is not working in c#, I don't know why.
webBrowser1.Document.InvokeScript("document.getElementsByName(\\"submitAddressButton\\")[0].click()");
But,
When I tried in web console. seem…

Jigu Jigu
- 145
- 1
- 10
1
vote
1 answer
Invoke Click Cefsharp VB
I would like to simulate a click or keypresses to a web browser element that is on my visual studio vb project.
I have found ways to do it for the webbrowser object built-in to visual studio, but I am using the cefsharp browser, so
…

WilkyRL
- 35
- 1
- 11
1
vote
0 answers
How to Invoke Selecting from a Combobox
I know how to use
Invokemember("Click")
to simulate clicking in web browser. But I cant find the c# code for simulating the selection and then clicking an option from a combo box in a specific URL.
The selection can be done by:
…

Mike
- 369
- 5
- 21
1
vote
2 answers
How to invoke a method which takes input parameter as another class object using Reflection in C#?(Method gives argument exception)
I am using Reflection in the following manner:
a) Loading the assembly
b) Getting all the methods and their respective parameters
c) invoking the methods
There are not issues faced while invoking methods which take input type as primitive…

Pragya
- 11
- 2
1
vote
2 answers
How do you InvokeMember with WebKitBrowser?
In a regular WebBrowser you can click something with this code:
webBrowser1.Document.GetElementById("welcome_box_sign_in_button").InvokeMember("Click");
But in a WebKitBrowser, there is no .InvokeMember. How do I go about doing this?
This is the…

Dozer789
- 1,980
- 2
- 23
- 43
1
vote
1 answer
Invoke derived class methods from base abstract class (reflection)
Consider next situation -
public class Derived : Base{
X(ParamX){} // xx method
X(ParamY){} // xy
}
public abstract class Base {
InvokeX(IParametr param){
...some magic
}
}
public class ParamX : IParametr {}
public class…

tony
- 359
- 1
- 3
- 15
1
vote
2 answers
how to set values to a two-dimensional Excel range?
I need to build an excel sheet from a list of test-cases in a specific format in order to upload it it to the server.
I've trubles to populate the two dimensional range of "expected" and "actual" in the file.
I use the same methods in order to…

Elad
- 63
- 1
- 2
- 7