Got more questions? Find advice on: SQL | XML | Regular Expressions | Windows
in Search
Welcome to AspAdvice Sign in | Join | Help

In the Trenches

Joe's Thoughts

InteropServices.SEHException

Well, in my adventures I ran into a bug, not sure if it’s a bug or not, not sure how I even generated it or what code causes it, though it’s some kind of bug or something or other.

 

I built a custom PrintView using the printdoucment class which we all know is just a wrapper around the COM object. Why has MS not dedicated enough resources in getting rid of the COM’s? They are like some disease that won’t go away!

 

I built my PrintDocument so that it could read an XML file and get the datasource and build a report, but guess what? I kept getting this error "InteropServices.SEHException: External component has thrown an exception", it seems that if I add “Application.EnableVisualStyles()” to my Main Sub routine in my application and then tried to use my component, I would get this very nice and extremely useful error. Granted I built a form in the background, populated it with controls and then used databinding to navigate between sets of records and then steal all the paints of each control to paint my report. Never mind that, but having that EnableVisualStyles only messed up my whole solution. Never mind it was almost impossible to find, only until I started looking for something non-print related that I found this:

 

http://blogs.msdn.com/asanto/archive/2004/08/18/216825.aspx

 

So, take out that line and boom my report reader works like a charm, I suspect that what happened was it was trying to use the visualstyles on my controls and got turned around somewhere and decided to give my live hell. Those good for nothing COMS!!

 

Anyways, since I found little to no info, I figured to write this, so keep it safe when using the print controls/components.

 

Does anyone know why they are still COM wrappers in 2005? It’s just insane if you ask me, though maybe that will change one day.

 

To all a good night and happy Forth of July!!!

Published Monday, July 04, 2005 12:15 AM by jfuentes
Filed under: ,

Comments

No Comments
Anonymous comments are disabled

About jfuentes

Jose Fuentes is the Co-Founder of the Capital City .NET Users Group of Florida, he helped organized and build the community and community web site (www.tlhdotnet.net). He’s an active MVP (Most Valuable Professional) for Microsoft, and strongly involved in the .NET community. He gives presentations and loves helping others with problems. You can find many of his posts and work on www.aspalliance.com, www.planet-source-code.com and www.windowsforms.com. He’s an active columnist for the asp alliance and Co-Authored in the ASP.NET Cook Book and currently working on a Smart Client book. His experience in .NET spans back to the early days of the first beta and he has a passion to spread the word to as many welcoming and un-welcoming ears that he can. Specializes in VB.NET and windows applications (rich client/smart client), also very knowledgeable of VS 2005 (been in beta since July 2003, after being invited to Microsoft). He’s very handy with MS SQL server 2000 and MSDE.