Wednesday, October 21, 2009

Long Lost Friend Found: SelectCurrentWord

In versions previous to Visual Studio 2008, there was a keystroke that I used all the time: CTRL + W. This selected the current word that your cursor was on in the code. However, once I upgraded to Visual Studio 2008, they remapped that keystroke. After a lot of Google searching, I finally stumbled upon the new keystroke: SHIFT + CTRL + W!

I feel like I've found my long, lost friend.

Tuesday, April 7, 2009

IE8 Compatibility View Icon Proposal

I can never tell if the compatibility view button in Internet Explorer 8 is activated or not. Therefore, I propose this newly designed icon to make it more clear. What do you think, Microsoft?

Wednesday, March 11, 2009

Cleaning Visual Studio Recent Projects

If you have ever changed the path of a Visual Studio project, you have probably discovered that a broken link remains in the "Recent Projects" section on the start page. If you click the broken link, Visual Studio informs you that the project is missing and asks if you would like to remove it from the list. This works fine for one project, but if you have moved several projects, the Recent Projects list becomes polluted with broken links.

I wanted to find a way to clean up that list, so that only valid projects were displayed. Fortunately, there is a way--by using the good, ol' registry.

The project links are stored under this path in the registry: (the 8.0 part may be different depending on your version of Visual Studio):

HKCU\Software\Microsoft\VisualStudio\8.0\ProjectMRUList

If you navigate to this path in regedit, you can manage the list. I ended up just deleting all of the entries to give me a clean slate. After doing that, when I loaded up Visual Studio, the Recent Projects list was cleared. I was then able to open each project manually, which repopulates the list with the correct project paths. You could also modify the paths for each entry, but I was too lazy for that. ;)

Tuesday, February 3, 2009

MeasureIt Firefox Plug-in

One thing I love about Firefox is the broad range of available developer-friendly plug-ins. The other day, a co-worker of mine told me about MeasureIt, a handy plug-in that allows you to measure sizes of things on a web page, similar in concept to the IE Developer Toolbar's ruler.

Once installed, the plug-in displays at the bottom of your browser:



When you click on it, the current page you are viewing fades and you are given a cross-hair cursor. You can then click and drag a rectangle to measure heights and widths right on the page.

Tuesday, December 16, 2008

Typedef in C#

Note to self (and to anyone else interested):

A typedef in C++, such as

typedef short SmallNumber; // C++

can be translated in C# as

using SmallNumber = System.Int16; // C#

This example is trivial, but it's very handy to be able to create an alias for long type names, especially when you start getting into generics.

Monday, December 15, 2008

Quickly Adding Regions in C#

I've gotten myself into the habit of adding regions to the code in my C# files because it helps me organize the content better. Up until now, I have been typing the region tags manually, which isn't that much typing, but it is enough to be slightly annoying. Fortunately, there are a few shortcuts to help out.

If you are starting fresh and want to create a region with nothing inside, you can type #region and then press the tab key. This automatically adds the #endregion and allows you to add a region name.

If you want to surround existing code with a region, you can use Visual Studio's built-in region code snippet. Here's one way to do it:

1. Highlight the code you wish to wrap in regions.
2. Press Ctrl-K, Ctrl-X.
3. Select 'Visual C#' from the pop-up menu.
4. Select #region.

That is getting a little bit long, so recording a macro and assigning it a keyboard shortcut might be the way to go.

Wednesday, December 10, 2008

C# Drag-and-Drop

Just a quick entry to post a link I found the other day of a code example for implementing drag-and-drop functionality in a DataGridView object. I originally used it for the DataGridView and then expanded it to other controls as well. It works pretty slick without much coding. (The example code is written with good English comments, despite the German text at the top of the page. Fear not. :))