+1  A: 

You could always get a copy of resharper and one of the rules in there is what you are describing. Once you finish with your code you can do a format on the whole file or even solution and it will globally fix that rule for you.

spinon
I actually have resharper... I'm more so wondering about doing this on the fly (real time)
rockinthesixstring
I can't find this feature in the VB.NET version of ReSharper
rockinthesixstring
A: 

I had and have similiar problems. This is a habit which you can change. Yet, sometimes your brain is just wired to make the same mistakes. For instance, no matter what I do, I always type data instead of date.

You can change your behavior. Find some method that you find helpful for changing habits. Create a "personal code review" checklist and add this item. After a few months, you will find the space comes naturally.

If this is one of the "hard-wired" brain goofs, then create a *Visual Studio" macro that visit's CodeDom. Through the CodeDom namespace it is easy to find comments and make changes as needed. Why use regular-expressions?

If you want to use regular-expressions, because you are familiar and it is easier, then create a better expression to avoid potential errors.

Refactoring VB.NET code with regular expressions at http://www.vbmigration.com/Blog/post/2008/07/Refactoring-VB%2cNET-code-with-regular-expressions.aspx should be helpful in creating better regular-expressions.

AMissico
I am working on breaking the habit, but it's a hard one to break.
rockinthesixstring
A: 

This would be a pretty good case for an editor extension. You can detect when a line is whitespace, apostrophe, not white space and either insert the space or put a decoration so you will learn to follow the pattern. If you've moved to 2010, consider it - they are really pretty easy to write.

Kate Gregory
do you have references I can look at? I think this might not be a bad idea.
rockinthesixstring
http://www.codeproject.com/KB/macros/WriteExtensions.aspx is a train-the-trainer for those who want to deliver a one hour talk on editor extensions. You can use the demo script and code to help you get started. http://channel9.msdn.com/posts/VSIPMarketing/VSX103-Lighting-up-the-new-Visual-Studio-2010-Editor-with-Rich-Extensions/ is a presentation from the VSX folks that may also be helpful.
Kate Gregory