Top Ten Visual Studio 2005 Enhancements for Windows Forms Development (Part II)

Introduction

Last month, we began the first of a two-part series on the top ten Visual Studio 2005 Enhancements for Windows forms development. Here are the remaining features that we have found to be most compelling:

6. Improved Custom Controls Development

This feature addresses a nasty defect we’ve encountered in the current version of Visual Studio. This defect rears its ugly head when you implement multiple user controls and Windows forms in a single .NET assembly, and you attempt to drag-and-drop an instance of a control onto a form that are both defined in the assembly. First of all, you need to insert the control into the toolbox manually. Then, when editing the form in the Forms Designer, the IDE will often remove the instance of your control, and all the associated initialization code, without warning! Visual Studio 2005 fixes this problem by automatically putting all custom controls in the toolbox automatically (after the first compilation of the assembly) and not automatically removing instances of custom controls from the form.

7. Partial Classes

Partial classes is a feature specific to the C# programming language that allows a single class to be defined in multiple source files. This allows multiple developers to more easily work on a single class simultaneously. All properties, methods, and events must be unique to the overall class. Thus, two methods with the same name and signature are not allowed in two separate source files for a single class.

8. Generics

A generic is a new C# programming language feature that is similar to a C++ template. It allows the programmer to parameterize the data type of a class, struct, or interface to allow the compiler to generate multiple versions of the construct. The net result is a performance gain, smaller code, and compile-time checking of parameterized data types. For example, instead of implementing a List class that maintains a collection of objects, a generic List class may be implemented that maintains a collection of any specific data type. The programmer may now refer to objects in the List as specific data types (instead of generic objects) without boxing and un-boxing and has the advantage of compile-time checking, resulting in fewer possible runtime errors and better runtime performance.

9. Code Refactoring and Method Rename

The code refactoring feature allows the developer to automatically break a long method into two smaller methods. To accomplish this, the developer highlights a series of statements contained in a single method, and selects the refactor item from the context menu. The IDE then creates a separate method, with relevant parameters, containing only the code statements that were highlighted, and inserts a call to the method, with parameters, where the highlighted code was removed. The method rename feature allows the developer to easily and quickly rename an existing method. It is activated either through a context menu or a smart tag that appears when the user hovers over the method definition. When activated, the name of the method, as well as every call to the method in the entire solution, is renamed. If you’ve tried to do this in the current version of Visual Studio, you’ve had to rename the method, build the entire solution so that the compiler will report all the build errors resulting from the renamed method, and then go fix each of these manually. This feature accomplishes all these steps without any user intervention.

10. New SplitContainer Control

A new, native SplitContainer control provided by Visual Studio 2005 provides a much simpler way to provide a vertical or horizontal splitter on your Windows form. The SplitContainer provides two containers upon which controls may be dragged-and-dropped. These containers are separated by a splitter which may be oriented either vertically or horizontally. Multiple instances of the SplitContainer may be nested to allow for multiple splitters on a single form.

Summary

The next version of Visual Studio, Visual Studio 2005, will provide the developer with a much more streamlined environment for implementing Windows forms applications more quickly. KMA will continue to work with the Windows Forms and Client Data teams at Microsoft to provide our feedback into the product. The latest Community Technology Preview of Visual Studio 2005 is available to MSDN Universal subscribers at the MSDN Subscribers download site.