Robert Green's Visual Basic Blog

VB Rocks!

Whidbey at the .NETDA Part 2

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:
Me.EmployeesDataConnector.MoveNext()

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!

 

 

Published Wednesday, February 11, 2004 6:37 PM by rgreen_msft

Comments

 

guercheLE@hotmail.com (Luciano Evaristo Guerche) said:

Great to hear from you again. Whidbey rocks!
Hope you keep us informed on the news...

--
Luciano Evaristo Guerche
Jacarei, SP, Brazil
February 12, 2004 5:49 AM
 

Random Thoughts of Jorriss said:

February 12, 2004 1:28 PM
 

Fred Beiderbecke said:

Is the functionality you're discussing in the build that will be distributed at dev days?

Great information.

Fred
March 12, 2004 11:30 AM
 

Robert Green said:

I believe the build at DevDays is the PDC build, which is many months old by now. I was using a much later build so some of what I showed won't be in the PDC build. For example, the binding to objects definately didn't work then.

But there are newer builds coming out between now and Beta 1. For example, we are giving out a newer build at VSLive and other events. Everything I showed should be in those.

Remind me to talk about how you get these builds in a future blog.
March 12, 2004 7:18 PM
 

Jorriss.Net said:

I love the MSDN blog feed.  Frank Prengel writes about a study between .Net and Websphere where...
April 23, 2006 4:38 PM
Anonymous comments are disabled

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker