Previously on my blog I wrote about showing VB Whidbey to the .NET Developers Association General Meeting in Redmond. I covered IDE enhancements aimed at increasing productivity. Here I'll cover Data.

I showed the Data Sources Window. You can use it to connect to data from a database, a Web service, an object and a database local file. (You can still connect to data using the Server Explorer, but the Data Sources Window provides additional capabilities.) I dragged the Employees table onto a form and got a databound grid and a navigation toolbar. Hit F5 and the form shows up with data in the grid. No code required!

In the Data Sources Window the Employee table has a dropdown next to it which lets me specify whether I want a grid or individual controls when I drag onto the form. Also, each field in the table has a dropdown that lets me specify which control to use. I showed how to specify a user control for the phone field.

I talked about the navigator, a new WinForm control. It understands the data binding and has buttons for next, previous, add, delete, save, etc. Of course, you don't have to use it. I deleted it and showed that although it understands the data bindings, it doesn't contain the data bindings. I added a next button to the form and wrote the following code:

The DataConnector is a non-visual control that surfaces the form's BindingManager. This is more intuitive for folks new to .NET. I've seen several times on newsgroups somebody asking how to bind to data and scroll. They are used to typing Recordset.MoveNext but in VS 2002 and 2003 they have to find the BindingManager and set its Position property. That will of course still work in Whidbey, but those used to scrolling through the data by calling a method of the data/recordset will find the DataConnector easy to use.

I closed by showing binding to an object. I was asked if the object needs to expose an interface and the answer is no. Just public properties is all that is needed. And you have to write the code to load the data since we won't assume we know how you want your data loaded. So in my example, I added this to the form's Load:
Me.CustomerDataConnector.DataSource = ObjectBinding.Business.CustomerFactory.GetAllCustomers
where ObjectBinding.Business is the namespace and the CustomerFactory class has a GetAllCustomers method.

My part of the user group lasted an hour and I covered all of 2 things! Whidbey is a major release folks!