Database Reference
In-Depth Information
Figure 19-11. The Design view of the PublishCurrency form
17. Double-click the empty surface of the form, and it will open the code editor
window, showing the PublishCurrency_Load event. Place the code listed in
Listing 19-1 into the load event code template.
Listing 19-1. Using the Entity Data Model
AWCurrencyEntities currContext = new AWCurrencyEntities();
foreach (var cr in currContext.Currencies)
{
txtCurrency .AppendText(cr.ModifiedDate.ToString());
txtCurrency.AppendText("\t\t");
txtCurrency.AppendText(cr.CurrencyCode.ToString());
txtCurrency.AppendText("\t\t");
txtCurrency.AppendText(cr.Name.ToString());
txtCurrency.AppendText("\t");
txtCurrency.AppendText("\n");
}
18. Build the solution, and run the project. When the PublishCurrency form
appears, you will see all the currencies listed in the TextBox. The screen shown
in Figure 19-12 should display.
 
Search WWH ::




Custom Search