Hi

I am working on a project where i am using open source files.
I am getting error ' Starting a second message loop on a single thread is not valid operation'.
First I changed Application.Run to Form.ShowDialog but still I am having same issue.
Other thread (Application.Run) is in open source file.
Anybody know how to solve this isssue?

Hi,

I guess I had a similar issue, that I solved like this :
In the main thread, I want to start a new WindowsForm :

  Thread t = new Thread(StartMyForm);
  t.TrySetApartmentState(ApartmentState.STA);
  t.Start();

And

public static void  StartMyForm()
        {
            Application.Run(new MyForm(..));
        }

Hope it may help.
Patrick.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.