Reputation: 69
I have a simple winform that just has a Microsoft.Office.Infopath.FormControl object as a child control, and basically does nothing. When I run a standalone project, the form opens fine, but when called from an asp page ( Visual studio development environment), I get the following error.
Unable to get the window handle for the 'FormControl' control. Windowless ActiveX controls are not supported.
After a little research, I found that it might be because of MTA threads. I also set the apartment state to STA, and still am getting the same error.
This is required for a bigger project i'm working on to open infopath as a COM object.
Please advice.
P.S -- There is no need for example code because there is practically no code at all. All i'm doing in the asp page is :
Form1 myform = new Form1();
myform.Show();
//or
myform.ShowDialog();
Its really urgent!!
Upvotes: 0
Views: 167
Reputation: 25495
You can not open a form from a web project. There is no message loop or even a desktop to display it on. You can interact with programs on the server but that is general done though a windows service which also shouldn't display forms. You need to reexamine your approach.
Upvotes: 2