Linked Questions
85 questions linked to/from Automating the InvokeRequired code pattern
0
votes
0
answers
63
views
Generic method to handle invoke [duplicate]
I'm getting tired of trying to figure out when and where an invoke is required. Rewriting this code over and over inline is tedious. I have created the method below to help solve this issue:
public ...
0
votes
0
answers
23
views
Winforms Textbox InvokeIfRequired not available [duplicate]
I am working to derive an ASCOM driver for an DIY astronomical dome from an example of a focuser.
Here the original for a focuser device:
ASCOM.EQFocuser.Focuser focuser;
public MainWindow(...
133
votes
9
answers
72k
views
Why must a lambda expression be cast when supplied as a plain Delegate parameter
Take the method System.Windows.Forms.Control.Invoke(Delegate method)
Why does this give a compile time error:
string str = "woop";
Invoke(() => this.Text = str);
// Error: Cannot convert lambda ...
50
votes
8
answers
20k
views
Cleaning up code littered with InvokeRequired [duplicate]
I know that when manipulating UI controls from any non-UI thread, you must marshal your calls to the UI thread to avoid issues. The general consensus is that you should use test InvokeRequired, and if ...
38
votes
5
answers
53k
views
Best Way to Invoke Any Cross-Threaded Code?
I know that this question has been asked before, but I'm looking for a way to:
streamline the creation of safe cross-threaded code.
reuse this code in any situation (no Windows Forms references).
Here'...
40
votes
6
answers
9k
views
What's wrong with calling Invoke, regardless of InvokeRequired?
I've seen the common setup for cross threading access to a GUI control, such as discussed here:
Shortest way to write a thread-safe access method to a windows forms control
All the web hits I found ...
27
votes
4
answers
17k
views
Is it possible to display Serilog log in the program's GUI?
With the logging system Serilog is it possible to display the log in a text box, or a list view or some other GUI control; what is the mechanism to get it there?
11
votes
2
answers
81k
views
How to update textbox on GUI from another thread [duplicate]
I'm new with C# and I'm trying to make a simple client server chat application.
I have RichTextBox on my client windows form and I am trying to update that control from server which is in another ...
4
votes
12
answers
20k
views
Buttons Enabled Property not Working Properly
I am creating an Windows Application. I have two buttons.
I have written the following code snippet.
frmRb obj = new frmrb();
private void btnPd_Click(object sender, EventArgs e)
{
...
8
votes
4
answers
28k
views
How to Invoke the progress bar in Status strip?
I am using the following code to invoke the controls that are on the main UI thread in my application. The progress bar that I have in my Status Strip does not have a InvokeRequired, I need to somehow ...
6
votes
3
answers
15k
views
Multiple UI Threads - Winforms
I want to create multiple UI threads in my application. I have simulated the scenario as below. I am creating a new window / form on a button click in a background thread
namespace ...
4
votes
4
answers
15k
views
Convert Console.WriteLine into textbox
Console.WriteLine("Network adapter: {0}", adapters[i].Name);
Console.WriteLine(" Status: {0}", adapters[i].OperationalStatus.ToString());
Console....
4
votes
5
answers
15k
views
Close a form from an external thread using the Invoke method
I have to close a Form from a thread and I am using the Invoke method of the Form for calling the Close() method.
The problem is that when closing, the form is disposed and I get an ...
2
votes
2
answers
7k
views
How to access a non-static method from a thread in C#
I'm not sure if this is good programming etiquette, anyway I have a normal method in which I update certain bits of data and UI elements such as textblocks etc.
Anyway, I want to create a thread that ...
3
votes
5
answers
6k
views
C# - Updating GUI using non-main Thread
I have a program that has Classes
GUI
Upload
and a buffer between the 2 classes - ie used to communicate between the 2 classes .
The Upload class uses Process to run an command line FTP app. I ...