I have written some code that calls a form. I am trying to have a user enter his employee number to check something and need to wait to complete the op until the form closes and the employee number is recorded. The issue is, that the Form pulls up and the op is completed. is there a way to wait for that form to close before it continues the code?
I have tried to async with await on certain tasks and put the labor.EndActvity into its method and set the task list but get very strange errors.
For instance:
************** Exception Text **************
System.InvalidOperationException: DragDrop registration did not succeed. —> System.Threading.ThreadStateException: Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it.
at System.Windows.Forms.Control.SetAcceptDrops(Boolean accept)
— End of inner exception stack trace —
at System.Windows.Forms.Control.SetAcceptDrops(Boolean accept)
at System.Windows.Forms.Control.OnHandleCreated(EventArgs e)
at Infragistics.Win.UltraControlBase.OnHandleCreated(EventArgs e)
at System.Windows.Forms.Control.WmCreate(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
just wondering if anyone has done anything like this before or has any tips for me.