Free Hit Counters
http://www.dellasdeals.com

[翻译]ADO.NET Entity Framework Beta2(七)/快速入门(实体框架)(2)/创建ClassSchedule窗体应用程序

In this task, you will create the Class Schedule Windows application by using Visual Studio 2008.

在这一任务中,你将使用Visual Studio 2008 创建ClassSchedule窗体应用程序

To create the Class Schedule application by using Visual Studio

使用Visual Studio创建ClassSchedule应用程序

  1. On the File menu, point to New, and click Project.
    文件菜单点击新建项目。(我用的VS2008Bata2 Team Suite中文版和帮助上的步骤略有不同)

  2. Choose either Visual Basic or Visual C# in the Project Types pane.
    项目类型面板中选择Visual BasicVisual C#。

  3. Select Windows Forms Application in the Templates pane.
    模板面板中选择Windows窗体应用程序。

  4. Enter ClassSchedule for the project name, and then click OK.
    给项目起名为ClassSchedule,然后单击确定。(右上角的.NET框架版本选择器应该选3.5哦)

To create the Class Schedule form/创建ClassSchedule窗体

  1. In the ClassSchedule project, select the default form (Form1), change the Name property to StudentSchedule, and change the Text property to Student Schedule.
    在ClassSchedule项目中选择默认窗体(Form1),修改窗体的Name属性为StudentSchedule,再修改Text属性为Student Schedule

  2. In the Solution Explorer, double-click the StudentSchedule form.
    在解决方案资源管理器中,双击StudentSchedule窗体。

    This opens the form designer.
    该操作打开窗体设计器(晕,默认就已经打开了啊)

  3. In the Toolbox, expand Common Controls, drag the ComboBox control to the form, and change the name of the control to studentsList. 在左侧的工具箱里,展开公共控件面板,向窗体上拖放一个组合框控件,将该控件的Name属性修改成studentsList

  4. In the Toolbox, drag the Button control to the form, change the name of the control to closeForm, and change the Text value to Close.
    再次从工具箱向窗体拖放一个按钮控件,更改按钮控件的Name属性为closeForm,Text属性修改为Close

  5. In the Toolbox, expand Data, drag the DataGridView control to the form, and change the name of the control to studentClasses.
    展开左侧工具箱的数据面板,拖放一个数据表查看器控件到窗体上。更改他的Name属性为stucentClasses.

  6. Double-click the closeForm button control.
    鼠标双击窗体上的closeForm按钮。

    This opens the code page for the form and creates the closeForm_Click event handler method.
    本步骤将打开当前窗体的代码视图并自动为closeForm按钮创建closeForm_Click事件处理方法

  7. In the closeForm_Click event handler method, type the following code that closes the form:
    在closeForm_Click事件处理方法的方法体内按实际项目语言输入下列代码以关闭窗口。

    Visual Basic
    ' Close the form.
    Me.Close()
    C#
    // Close the form.
    this.Close();

Next Steps/下一步

You have successfully created the class scheduling application. Next you will generate the mapping files that describe an Entity Data Model (EDM) based on a 1:1 mapping against the School database that you created in the first task:

您已经成功创建了ClassSchedule应用程序.下一步你将开始使用在第一个任务中创建的学校数据库来生成一个与数据库一一对应的实体数据模型映射文件.

Generating the School Entity Data Model/生成学校实体数据模型

See Also/请参考

Concepts/概念

Quickstart (Entity Framework)/快速入门(实体框架)

Other Resources/其它资源

Feature Reference (Entity Framework)/功能参考(实体框架)

 

posted @ 2007-09-21 15:23  徐少侠  阅读(1607)  评论(2编辑  收藏  举报
作者:徐少侠 出处:http://www.cnblogs.com/Chinese-xu/

本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,如有问题,可以通过 Chinese_Xu@126.com 联系我,非常感谢。