Questions tagged [invoke]

Executes the specified delegate on the thread that owns the control's underlying window handle.

The Invoke method searches up the control's parent chain until it finds a control or form that has a window handle if the current control's underlying window handle does not exist yet. If no appropriate handle can be found, the Invoke method will throw an exception.

1794 questions
0
votes
3 answers

Serial port data received handled too slowly

I am reading data from an arduino at a baud rate of 115200. The data comes in as a string on its own line in the format: . I believe that the problem with my code is that it is not handling the incoming data fast enough and the…
C Raber
  • 63
  • 1
  • 9
0
votes
0 answers

How do I use a String as a reference to a Class using reflection?

I'm building a String parser that parses a file, gets stuff, and does stuff with the stuff. Mainly, I am trying to reference classes from that file. If that file had some text: "Class1" How could I interpret the String as a Class within the program…
AMDG
  • 1,118
  • 1
  • 13
  • 29
0
votes
1 answer

Invoke required is not true when function is called in loop

I have a strange issue. I have following code in my function: if (this.InvokeRequired) { this.BeginInvoke((MethodInvoker)delegate { LoadGamesAndRefreshView(); }); …
0
votes
1 answer

VB.NET Wait after invoke

Is it possible to invoke a function from a "non main" thread and then wait for it to finish before executing the rest? I could set a boolean just before and then make the function "flip" the boolean to false when its done, but I wondered if there…
user3494322
  • 171
  • 3
  • 11
0
votes
1 answer

Cross-thread operation not valid and Invoke statement

I have a Mainform with many controls on it.Now I'm trying to access this controls from a thread.Should I use invoke statement for each instruction?!!! or there is another way? a piece of my code is: switch…
Fateme
  • 21
  • 7
0
votes
0 answers

Begininvoke without endinvoke and background thread start differences

I've seen a few questions here about begininvoke and fire and forget and such and also a question about endinvoke if it has to follow a begininvoke or not. For more on the last part here: Must every BeginInvoke be followed by an EndInvoke? My…
Thomas
  • 2,886
  • 3
  • 34
  • 78
0
votes
0 answers

Invoke click action for javascript confirmation box in C# browser

I wrote a browser in C# and it navigates custom pages, invokes specified buttons by using navigated "HtmlDocument". However, one of the buttons displays a confirmation box written in JS. onclick="return confirm('Are you sure ?');" This is not my…
JoshuaJeanThree
  • 1,382
  • 2
  • 22
  • 41
0
votes
2 answers

How to invoke components

In my apps i use backgroundWorker, to set text in some TextBox, I need first to invoke that TextBox. First I use: if (someTextBox.InvokeRequired) { someTextBox.Invoke((MethodInvoker)delegate { …
Frink
  • 221
  • 4
  • 23
0
votes
1 answer

Passing Objects as Arguments to Dispatcher.Invoke in WPF

I have created a BitmapImage Variable in a new thread and need to pass as Argument of Dispatcher.BeginInvoke to UI Thread. But Error Occurred: Exception has been thrown by the target of an invocation An unhandled exception of type…
GiGatR00n
  • 116
  • 8
0
votes
2 answers

Invoke method with an Object List

This code allow me invoking a method with tests parameter Method m = aClass.getDeclaredMethod(methodName, paramTypes); Integer n =10; Object retobj =m.invoke(o, "test",n); System.out.println(retobj); Now I want to invoke the method with the…
user567
  • 3,712
  • 9
  • 47
  • 80
0
votes
1 answer

What is the proper method for using invoke to avoid threading errors?

I have been recently learning C# and have a problem I just cant seem to wrap my head around. Please forgive me if this is noobish as I am very new to C# but my question is about delegates and invoke. I have read many many tutorials online and…
0
votes
0 answers

c++ MFC SDI DLL call method of OLE Server using IDispatch

I have written a c++ MFC DLL that brings up an SDI Application which is a very legacy OLE Server. (I have no choice about using this OLE Server so I have to make it work.) I am accessing this c++ DLL from C#. I have everything "working". I can call…
user3739214
  • 81
  • 1
  • 6
0
votes
2 answers

Invoke method in new thread (method name from string)?

Im trying to invoke a method on a new thread in a winforms c# app. But I need the method name to come from a string. Is it possible to do something like: public void newThread(string MethodName) { new Thread(new…
Developr
  • 447
  • 8
  • 21
0
votes
1 answer

How to execute a matlab file on the background through Java?

I have a Java program that makes some changes to a matlab file that reads and executes a function. Is there a way to invoke and run this read.m file through the Java program without having to open Matlab? I tried searching matlabcontrol…
user3211165
  • 225
  • 1
  • 3
  • 14
0
votes
1 answer

C# dynamic dll call gettype

So I created this dll file, and i am trying to call the methods dynamically namespace getDirInf { public static class fileInf { public static long FileSizeRecursive(string strDirectory, long p_lnDirLength) { DirectoryInfo _dinf =…
user3423295
  • 15
  • 1
  • 4