xsharp.eu • Problem calling a Windows.Forms Dialog from X# Project
Page 1 of 1

Problem calling a Windows.Forms Dialog from X# Project

Posted: Thu Dec 23, 2021 10:29 am
by hilberg.it
Hi,
I am trying to instantiate a Windows.Forms Dialog with Webbrowser from a XPorted VO Application. Unfortunately I end up with the following Error Msg:
System.Threading.ThreadStateException: "Das ActiveX-Steuerelement 8856f961-340a-11d0-a96b-00c04fd705a2 kann nicht instanziiert werden, da der aktuelle Thread kein Singlethread-Apartment ist."


The solution might be, that I mark Windows Forms entry point as [STAThread] like suggested here or here.

The question is, how do I do this in my X# app? Since I believe that I don't have the main method like suggested by the links.

Thank you very much already.

Problem calling a Windows.Forms Dialog from X# Project

Posted: Thu Dec 23, 2021 10:45 am
by hilberg.it
Answering my own question:

Code: Select all

[STAThread];
FUNCTION Start() as void
   LOCAL oApp AS MyApp
   oApp := MyApp{}
   __SetAppObject (oApp)
   oApp:Start()
return