Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Win forms in XNA, exception even with [STAThread]


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 plusnoir   Members   -  Reputation: 106

Like
0Likes
Like

Posted 14 January 2012 - 11:50 AM

I am attempting to use System.Windows.Forms objects within an XNA application (as opposed to using a XNA device in a System.Windows.Forms application) - which has no examples as far as the AppHub samples go.
When I attempted to resize the window I got an exception indicating that the thread was not a STA thread; so I updated my Main method as follows:

[STAThread] // Added this
static void Main(string[] args)
{
	using (Game1 game = new Game1())
	{
		game.Run();
	}
}


After I fixed this problem; as soon as I draw some models (using the 'X' format) into the XNA window and try to resize, another exception occurs.

An unhandled exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.Game.dll Additional information:

A previous Draw call threw an unhandled exception. See InnerException for details.


Any idea how i could handle this?
Thanks in advance,
noir

Sponsor:

#2 Machaira   Moderators   -  Reputation: 1028

Like
0Likes
Like

Posted 01 February 2012 - 01:04 PM

I am attempting to use System.Windows.Forms objects within an XNA application (as opposed to using a XNA device in a System.Windows.Forms application) - which has no examples as far as the AppHub samples go.

Because you're not supposed to do it that way.
Microsoft XNA MVP | Check out my blog for random ramblings on XNA game development




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS