XTab's Blog

Ged Mead's Blog at vbCity

vbCity Blogs moved to:
http://cs.vbcity.com/blogs
  Home :: Syndication  :: Login

OctNovember 2009Dec
SMTWTFS
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

Archives

Topics

Ramblings

VB.NET

 In earlier versions of Visual Studio .NET  if you created a User Control in a Class Library project and wanted to have a quick preview of the work so far, you might have been tempted to hit that F5 key to run the project.     Unfortunately if you did that you were then stopped short with a message …

“A Project with an output type of Class Library cannot be started directly”

  The usual fix is to add a second project to the solution, (a Windows Forms project), and use the default Form1 as the drawing surface to display the control.
It wasn’t that much of a problem, but it was yet one more thing you had to remember.

  Quite usefully in VS2005, you can now “Run” a User Control that you are developing in a Class library project.  Of course it doesn’t really run it as such, as it’s a DLL, but what does happen is that you are shown a rather nifty User Control Test Container.   The visual representation of your control  is shown in a panel on the left, with all the available properties listed down the right hand side of the display.  

   You still need to revert to the old method of adding a WinForms project if you need to test events or methods of the user control and it also only works for controls you are designing from the ground up.  That is, it doesn’t work for custom controls you are building by inheriting from one of the VB.NET standard controls.

     Still it’s quite a handy little feature when you are starting out with a User Control of your own design  and want to do a quick check of the visuals as you go.

posted on Saturday, August 05, 2006 4:07 AM