Access forms by a thread

delegate void WriteStatusCallback(string statusMsg); 
 
public void WriteStatus(string statusMsg)
{
    if (InvokeRequired)
    {
        Invoke(new WriteStatusCallback(WriteStatus), new Object[] { statusMsg });
    }
    else
    {
        // Access Windows forms control
    }
}

Download this snippet

Accessing Windows forms controls needs special handling by the Invoke() function.

Twitter Twitter

0 Comments to “ Access forms by a thread”

Leave a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>