A BindingSource component also was placed on the form. Typically, you will use a BindingNavigator
component together with a BindingSource component to provide users with quick and easy navigation
of data on a form. The BindingSource component encapsulates the data source for a form.
307
Part III: LINQ to SQL
Figure 15-20
Figure 15-21
Select the contactBindingSource control and then open the Properties window (see Figure 15-22). You??™ll
notice that the data source for this component comes from the data source defined previously.
308
Chapter 15: Advanced LINQ to SQL Topics
Figure 15-22
As the form sits right now, it is useless. The good news, however, is that it??™s easy to wire these controls.
Right-click any gray area of the form, and select View Code from the context menu.
As with all of the other LINQ to SQL examples, you still need a DataContext reference, so after the partial
class definition of Form1, add the following code:
private AdventureWorksSalesDataContext db = new
AdventureWorksSalesDataContext();
Next, in the Form1 Load() method, add the following code:
contactBindingSource.
Pages:
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487