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 [...]
Posts Tagged: Windows Forms
Assembly Binding Redirection in .Net
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
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 [...]
How to get all controls from a form at runtime in C#
Here is a code snippet which helps you to enumerate all the controls in a form. This snippet can be used for any control, to find the child controls. And you can invoke this function like this, to enumerate all the controls of a Form.
Using SynchronizationContext in 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
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.