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
5
votes
2 answers

method invoked or method called?

I am not sure if this question is relevant but I see the expression "the method is invoked" a lot , So Is there a technical difference between invoking a method or calling a method or It's just other word for the same action ? P.S : Clearly , I am…
Ahmed
  • 3,398
  • 12
  • 45
  • 64
5
votes
1 answer

Reflection: invoke a method with generic parameter

I everyone, I have some issues with invoking a method with reflection. The method sign is public T Create(TK parent, T newItem, bool updateStatistics = true, bool silent = false) where T : class where TK : class; public T…
Alex
  • 191
  • 2
  • 10
5
votes
4 answers

C# Winforms Threading: Closed Form Gets Invoked

The following code demonstrates my dilemma. The code creates a background thread which processes something, then Invokes the UI thread with the result. It may throw an exception if the background thread calls Invoke on the form after the form has…
drifter
  • 611
  • 5
  • 17
5
votes
2 answers

Wait for another method to invoke and then continue with result

I am trying to invoke a method from another .dll file . It is sending a message through the VPN then Return the RecievedMessage from another computer. As you now it takes time to sending and receiving message and VpnObject just send message and I…
Mohammad Sina Karvandi
  • 1,064
  • 3
  • 25
  • 44
5
votes
6 answers

Which C# assembly contains Invoke?

Alternate question: Why is VS10 so keen to complain about Invoke? In my continuing quest to make my app work become the worlds best C# programmer, I have decided that threads are a Good Thing™. MSDN has a helpful article on making thread-safe calls…
Tom Wright
  • 11,278
  • 15
  • 74
  • 148
5
votes
2 answers

Do I need to invoke MessageBox calls?

To pop-up a message box, I'm using MessageBox.Show(...). I usually wrap the call in an Invoke: BeginInvoke (new Action (() => { MessageBox.Show ()); })); (I removed a part of the original question which was answered elsewhere) Do I always need…
mafu
  • 31,798
  • 42
  • 154
  • 247
5
votes
2 answers

Why does VS2010 always break on exception from MethodInfo.Invoke?

I have a try/catch around a MethodInfo.Invoke(o,null), and VS2010 is set to never break on Exceptions, but unfortunately the debugger continues to break inside the Invoked method. The method is static, and I've got the Phone Developer Beta…
exsulto
  • 2,475
  • 2
  • 15
  • 10
5
votes
2 answers

can be 'this' omitted when invoking method in Java?

I have silly question about Java (6/7/8) grammar - are those two snippets of method invocation always equivalent? with this this.myMethod(4); without this myMethod(4); Note: Of course the problem is about every number, type and combination of…
petrbel
  • 2,428
  • 5
  • 29
  • 49
5
votes
1 answer

C# wait for MethodInvoker to finish

I need to accomplish the following scenario. ThreadMethod() is a Timer method, where I have UI update in the Invoke statement. I need to wait till the Invoke finish its work, and then continue the method. How can I cope with this? public void…
ContentPenalty
  • 447
  • 1
  • 5
  • 14
5
votes
1 answer

Me.Invoke in VB.NET doesn't actually "Invoke" - threads stall on Invoke statement

I've got the following code: Public Delegate Sub SetStatusBarTextDelegate(ByVal StatusText As String) Private Sub SetStatusBarText(ByVal StatusText As String) If Me.InvokeRequired Then Me.Invoke(New SetStatusBarTextDelegate(AddressOf…
SqlRyan
  • 33,116
  • 33
  • 114
  • 199
5
votes
3 answers

Control.Invoke getting 'stuck' in hidden ShowDialog

(I have a workaround for this problem, but it's not the first time I've been bitten, so I'm trying to understand exactly what's going on.) From my application, I ShowDialog a form. On the form is a button, which when clicked calls code on another…
Benjol
  • 63,995
  • 54
  • 186
  • 268
5
votes
4 answers

Why would an event be null? (object reference not set to an instance of an object)

I have a form with a button, a label and a progress bar, so that when I click the button it creates an instance of class b to run a process. Once the process is done it will call an EventHandler to show "done" in the main form's label! I created an…
daygoor
  • 120
  • 1
  • 1
  • 10
5
votes
2 answers

C# - Emgu cv How to load an image from a folder using CvInvoke.cvLoadImage("ClassPic1.jpg") as intptr and access it

How to load an image from a specific folder using Emgu cv CvInvoke.cvLoadImage(...)?I am tryng to do it like this IntPtr inputImage = CvInvoke.cvLoadImage("C:\\Users\\...\\ClassPic1.jpg"); Is that ok? If so, How am i gonna access it later as an…
Sisay
  • 681
  • 7
  • 16
  • 31
5
votes
2 answers

.NET Invoke Process Flow

I see/use some form or fashion of the code all the time: public void method1(Object sender, EventArgs args) { if(dataGridView1.InvokeRequired) dataGridView1.Invoke(new EventHandler(method1), null); else // Do something to…
poy
  • 10,063
  • 9
  • 49
  • 74
5
votes
4 answers

Invoking Method on UI thread from within a Lock()

I have two methods, MethodA & MethodB. MethodB has to run on the UI thread. I need them to run one after the other without allowing MethodC to run between them. MethodC is called when a user clicks on a lovely little button. What I did to ensure…
E.T.
  • 949
  • 8
  • 21