[dba-VB] Tough to track down bug (in VS?)

jwcolby jwcolby at colbyconsulting.com
Sun Dec 5 12:43:06 CST 2010


I ended up with a list view with a column named DateTime.  The .Net framework has a DateTime object. 
  As soon as I dropped a copy of this list view on a form that had the .Net DateTime object in its 
code, the project had build errors.  VS decided that the DateTime object (DateTime.now anyone?) that 
was already in my code was magically a column object, which dies not have a .Now property.

Lesson (which everyone already knows): Never name your objects using keywords from the language.

As soon as I renamed my column to Date_Time, VS went through the code in that form and renamed the 
DateTime objects out in code to Date_Time as well.  Once I found and fixed *those*, voila, my code 
compiled again.

That one had me going for quite awhile.  I knew it had something to do with that listview because 
dropping that on the form was the last thing I did before the compile error popped up, but tracking 
down the exact cause was tough!

-- 
John W. Colby
www.ColbyConsulting.com



More information about the dba-VB mailing list