Visual Studio couldn't find where the type of this object (CDetail) was declared.
Instead of saying something like, "CDetail is not declared in this context" or something like that, it sent me on a wild goose chase.
I am keeping this question up in case someone else comes across this problem.
Thanks to everyone for the help.