views:

31

answers:

1

I have a weird situation on a winform project.

I have user control (with 600 lines of code around) with a datagridview. I change de ColumnHeaderStyle of the font and save it. After I save the file I close it and open again, the changes were not saved (although the asterisk is dissapeared), because the ColumnHeaderStyle is back to the former value. This is driving me crazy because I cannot change any visual thing in the Designer.

Any clue?

Thanks in advance.

A: 

I've had occasional very strange behaviour with VS2008 developing WinForms apps too. Mostly designers that won't display (even though nothing has changed), but I've had cases of disappearing controls, too (and hence compilations that won't complete since code then refers to controls that are no longer being created). All very irritating.

Assuming that you've done all the standard things, like Cleaning the solution (on the Solution's context menu), deleting all the relevant Bin and Obj folders (no idea why this would cures VS weirdnesses, but it sometimes does) and rebuilding (ensuring that the Designer for your user control is closed when you rebuild)...

... you might try looking through the designer code for some strange 'bonus' controls that apparently have nothing to with you.

In one particularly intractable case, I eventually noticed some controls with names like Button_01, Button_02, etc, whose origin I couldn't identify. They were being defined but not instantiated, and not being added to any controls collections, and I just deleted all references to them.

When I recompiled, they didn't come back, and VS was behaving itself again.

I can't explain it, but it worked that time, and I offer it as an example of VS gremlins that seem to have rather irrational solutions.

Maybe it was just a strange planetary arrangement that did it, I guess I'll never know.

ChrisA