The enableVisualStyles problem was the cause of my application crashing on Windows XP - MS please fix it this in a service pack
I finally found out what my problem was with my code that ran ok on 2000 but throws an exception on Windows XP. I have this piece of code
Application.EnableVisualStyles();
Application.Run(new mainForm());
Using the enablevisualstyles method XP visual styles are applied to your winforms when the application is running on Windows XP. Unfortunately there seems to be some bugs with enablevisualstyles. I got bitten by one of those bugs. My wizard control is displayed using ShowDialog() and this throws an exception on XP but none on Windows 2000. In order to solve the problem you must use the following code:
Application.EnableVisualStyles();
Application.DoEvents();
Application.Run(new mainForm());
There seems to be some other bugs with
enablevisualstyles and
from Code Project
Jeff I wish had remembered your blog entry last year about this problem. It would be so nice if this problem could be fixed in a service pack as it is a real pain.