Updating GUI from different threads

Even the smallest thing, when thought upfront, can help you go a long way. Whenever you create an application that is more that two forms thrown together, and that does a little bit more than just saying “Hello world”, you’ll encounter a point where you’ll want to use threads. So if you’re going to reach … Read more

Transparent Click-thru windows

It is often useful to provide the user with information on the screen, without interfering his work. Usually, you would just create a window with a somewhat lower opacity, allowing the user to see what’s beneath your window. However, this window will still receive all the normal windows events, and mostly, the user’s mouse clicks.To … Read more

Filtering Win32 messages of a form

I’ve recently came across a nice post on C# Frequently Asked Questions blog. In the post, they’ve shown a way to filter out, or (pre)process Win32 messages of a form. Let’s have a look at the code, then we’ll go through it. And in the form itself: As you can see, we’ve started by creating … Read more

Unbound items in a bound ComboBox

Introduction It is sometimes necessary to add items to a bound ComboBox that will appear at the beginning of the drop-down list. If you ever tried to add items to a ComboBox that was bound, you probably know that an ArgumentException is thrown, saying that Cannot modify the Items collection when the DataSource property is … Read more

Fading form while moving

The different between a nice application and an exellent one, is many time only in the small details. How much did the developers really put into it? How much they thought about every detail?The following code is nothing more than an eye-candy, but we all know that it’s those simple things, that take seconds to … Read more

Writing an IsApplicationRunning method

Introduction I never was a Win32 developer. But sometimes, the .NET classes just don’t make the cut. During my work, I needed a way to check if a certain application is running in the background. Obviously, I turned to the Process class that can be found in the System.Diagnostics namespace. Not much long after, I … Read more

Working with MAPI Items

While the Outlook objects expose most of the properties of the items they represent, sometime they miss the exact field that you need. In this post I’ll show you the very basics in retrieving information from the MAPI object that your CDO object represent. Assuming that you have an Outlook mail item, you need to … Read more

The Interlocked class

Working with threads and counters can because a really pain if you do not take care. Fortunately for us, .Net supplies us with a couple of methods that can make our life a little bit easier. The class Interlocked, which can be found in System.Thread allows you to increment, decrement, and set the value of … Read more

Prevent changing the state of a CheckBox

Preventing an item in a CheckedListBox or a ListView with CheckBoxed is a really basic requirement when dealing with GUI. The simple and elegant code is for some reason, quite under-sampled. Assuming that you know which item you want to prevent the user from changing, all you have to do is register on the ItemCheck … Read more

Using ComboBox with objects

In most of the cases where you need to use a ComboBox, you need it only so the user will be able to choose between a couple of string values. In the majority of the cases, you’ll have a list of objects that you’ll want the user to choose from, and you’ll have to do … Read more

SharePoint/MOSS Documents Libraries naming policy

When you create a new Documents Library in MOSS, you are asked to provide a title for that Library. The provided title will be later used to define the internal name of the Library, as well as its URL. This is where the problems start. It only makes sense that MOSS allows the user to … Read more