How to use existing Database in Windows Phone

Normally in Windows Phone apps, we used to create Database in the Application Launch event, like the following if (!dataContext.DatabaseExists()) { dataContext.CreateDatabase(); } And if there is any master tables you can write code to insert after database creation, like this. if (!dataContext.DatabaseExists()) { dataContext.CreateDatabase(); dataContext.Categories.InsertAllOnSubmit( new[] { DefaultCategory });...


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

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. var oApp =...


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...


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 var panel = sender as TableLayoutPanel;...


How to send email messages with embedded images

While creating email messages with HTML content, normally the images are displayed with IMG tag, where the SRC attribute pointing to an image, which is hosted in the web server. Most email clients will not display the images, which is downloading from the web. Instead of pointing to web URL,...


How to install NuGet packages directly

If you are developing applications using VS 2010 Express editions, you will miss the Package Manager console, which helps us to install libraries or packages via NuGet. The Nuget package manager console is not integrated to VS 2010 Express editions.(Visual Web Developer Express is an exception, it has a package...


K-MUG - Global Azure Bootcamp – 27 April 2013 - Infopark - Kochi

The Kerala Microsoft Users Group (K-MUG) will be organizing a Global Azure Boot camp on 27th April 2013 at Info park Campus in Kochi. K-MUG is one of the best developer community in India, which got Best User Group award in India as part of Microsoft Community Impact award 2010....


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. public static class Extensions { public static void EnumerateChildren(this Control root) { foreach (Control control in root.Controls) { Console.WriteLine("Control [{0}] -...


Using SynchronizationContext in Windows Forms

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 SynchronizationContext which allows us to execute a section of code in the UI context (the thread that created the UI). Also, it...


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. public const int WM_NCLBUTTONDOWN = 0xA1; public const int...