Force multi-threaded VB.NET class to display results on a single form

前端 未结 4 1838
走了就别回头了
走了就别回头了 2020-12-22 07:10

I have a windows form application that uses a Shared class to house all of the common objects for the application. The settings class has a collection of objects that do thi

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-22 08:01

    in c# it looks like this:

    private EventHandler StatusHandler = new EventHandler(eventHandlerCode)
    void eventHandlerCode(object sender, EventArgs e)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(StatusHandler, sender, e);
            }
            else
            {
              //do work
            }
        }
    

提交回复
热议问题