Monday, September 20, 2010

Telerik's RadProgressArea not displaying

We've had a page with a RadProgressArea control on it for some time now, which hasn't always appeared.

After many hours, I've isolated the problem, and it's a wierd one.

With the page class itself was the variable definition

private string UnnamedComponentString = StaticInitializerClass.UnnamedComponentStringInitializationFunction();

I'm not arguing that the above is good code (it really should be initialized in the constructor or the Page_Init rather than at the point of definition) but, to my great surprise, that line was the culprit.

When I change that line to a pure definition and moved the initialization to Page_Init, the RadProgressArea magically appeared! Go figure.

I tried reproducing this in a standalone website as a proof of concept, and it didn't work... so presumably the initialization itself wasn't the problem, it was the interaction between it and something else. Strange, but good to have solved the mystery at last.

Friday, August 13, 2010

Visual Studio 2010 doesn't play nice with "Windows Form Designer generated code" blocks

I've had some consistent but intriguing further issues with Design Mode for Windows Forms in Visual Studio 2010.

I have a base custom control type.

There are a number of controls that inherit from the base. In most cases, the logic of the inherited class is minimal: just providing some settings that the code in the base uses.

Nonetheless, despite the simplicity of these inherited controls, some of them consistently work fine in design view and some of them cause errors in Visual Studio's UI, which often require me to restart the designer, or even Visual Studio.

I'm hoping I've just found the answer, though.

I noticed that in two of these inherited controls - where one always worked and the other always caused trouble - the working one had a controlname.designer.vb code file, and the failing one had

#Region " Windows Form Designer generated code "


section.

I tried creating a designer file for the failing control, and copied the region into it.

Voila! It started working perfectly, every time!

Looks like Visual Studio 2010 doesn't play nice with "Windows Form Designer generated code" blocks.

Thursday, June 10, 2010

Can't Load Library in Visual Studio 2010 Design Mode for Windows Forms

Having trouble opening a form in the Designed in Visual Studio 2010?

If the form contains controls in another library, and that library is a project file in your solution, but it's complaining that it can't load the library not matter how many times you Clean and Rebuild everything, here's the workaround:

Open the compiler settings for the library that can't be loaded. Change something. Anything - just register a change. You can change it back if you like, as long as Visual Studio 2010 registers that the settings are "dirty".

Then compile everything.

Then open your form.

Yes, it worked for me (reproducably) after spending several hours scratching my head.

No, I have no idea why.