Problem calling a Windows.Forms Dialog from X# Project

This forum is meant for questions and discussions about the X# language and tools
Post Reply
hilberg.it
Posts: 74
Joined: Sun Sep 20, 2020 7:25 am
Location: Germany

Problem calling a Windows.Forms Dialog from X# Project

Post 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.
hilberg.it
Posts: 74
Joined: Sun Sep 20, 2020 7:25 am
Location: Germany

Problem calling a Windows.Forms Dialog from X# Project

Post 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
Post Reply