Posts Tagged: Windows Forms

Retrieving the COM class factory for component failed due to the following error: 800702e4.

Posted by & filed under .Net, .Net 4.0, Office Interoperability, Visual Studio, Windows Forms.

While working on some outlook C# application I got a COM exception like this. Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005. My code was simply straight forward, I was just creating the instance of the outlook application. And this code was used in a different [...]

Assembly Binding Redirection in .Net

Posted by & filed under .Net, .Net 4.0, ASP.Net, Windows Forms.

Today I come across an application crash due to version mismatch. The application executable was compiled using version 1.0.x.x, and we were using 6.2.x.x. Due to this version mismatch application was crashing. Unfortunately we don’t have the source code of this application with us. Later I got one solution using bindingRedirect. This configuration element will [...]

How to apply border color for TableLayoutPanel

Posted by & filed under .Net, .Net 4.0, Windows Forms.

The TableLayoutPanel control arranges its contents in a grid. TableLayoutPanel doesn’t have border color property, but you can write custom code in CellPaint event to create border. Here is the code snippet which will help you to create border and apply color for TableLayoutPanel Here is the screen shot of the Form in Design Time [...]

Using SynchronizationContext in Windows Forms

Posted by & filed under .Net, .Net 3.0 / 3.5, CodeProject, Windows Forms.

Long back I wrote a post about how to fix – System.InvalidOperationException – Cross-thread operation not valid exception, while we try to access user interface elements from a different thread, other than the thread(normally main thread), which created the user interface elements. .NET 2.0 brings us SynchoronizationContext which allows us to execute a section of [...]

How to move a window or form without titlebar

Posted by & filed under .Net, Win 32 API, Windows Forms.

In my current project I had to implement move for a Form, which doesn’t have a title bar or FormBorderStyle property set to None. Instead of title bar I was using a Panel with background Image. Here is the code snippet. As it is WIN32 API call, you need to import System.Runtime.InteropServices namespace.