Numerous WinForms improvements will greet developers when they get started with Visual Studio 2005. Such advances can provide a better framework for client development. "There's a huge focus on productivity throughout," said Jay Roxe, product manager, development tools, Microsoft. Data binding, Click-Once deployment, AutoComplete and other important elements mark the new version of the tool set, according to Roxe and others.
Data binding. While data binding functionality has been around since VB 3.0, it was viewed as ineffective for developers who wanted applications for more than a handful of users. Thanks to enhancements in WinForms 2.0, Roxe said, apps based on data binding are now enterprise scalable.
Brian Noyes, chief architect of IDesign Inc. and .NET development veteran, identified four major data binding additions.
- Data Sources -- This window in the designer has been enhanced so that binding to databases, Web services or custom objects can be done via a drag-and-drop wizard. There's no need to go into the Properties menu and bind data manually, Roxe noted.
- BindingSource -- Basically, Noyes said, this lets developers keep multiple bound controls synchronized, change data sources without having to change data bindings and track what happens to the underlying data source.
-- If an item is added to or removed from a collection, or if an item's properties change, then the IBindingList interface will raise a ListChanged event.
- DataSet designer and TableAdapter classes -- These two features are not specific to WinForms, but they do ease data binding. "These are basically code-generated data access components that let you set up whole data access layers without ever writing any ADO.NET code by hand," Noyes said.
Data-related enhancements to WinForms are supplemented with other new additions to Visual Studio 2005.
Click and deploy. Over the years, developers have shied away from client-based applications in favor of Web-based apps, which are easier to deploy. Recognizing this, Microsoft introduces ClickOnce Deployment in WinForms 2.0.
This features accomplishes three things, Microsoft's Roxe said. First, it means developers no longer have to manually store the prerequisites for an application. Second, apps can now be deployed to the "Documents and Settings" part of the directory, which means they are fully installed apps available to all users. Previously, apps went in the "Programs and Files" menu and were subject to an administrator's control. Third, ClickOnce will check an application for newer versions at regularly scheduled intervals and then perform the update automatically.
AutoComplete. For years, developers have written their own code to finish off what was typed into a TextBox or ComboBox. With WinForms 2.0, Microsoft finally adds that functionality to Visual Studio 2005. According to Ken Getz, senior consultant at MCW Technologies and a widely read software expert, three properties govern this: AutoCompleteMode, AutoCompleteSource, and AutoCompleteCustomSource.
As Getz details in a CoDe Magazine article, each property offers several settings that determine how deeply an application searches for data to insert into AutoComplete and how it is presented to end users. "Given these combinations, it's easy to set up a TextBox or ComboBox so that users can select from a list of suggestions with minimal typing," Getz said.
There are plenty more additions to WinForms 2.0. One favorite for Roxe was a "snap-line" feature that makes sure controls are not off by one or two pixels. "It's one of those things that you work with for a little while and then say, 'How did I ever work without it?'" Roxe said.
Improvements to WinForms are important within the context of the overall Visual Basic community. The WinForms framework allows developers to build Windows client applications that use the .NET 2.0 CLR, while supporting a rapid application development programming model that is both familiar to the long-time VB user and a cornerstone of Visual Studio 2005.
Related WinForms development resources