《VB实训报告》word版_第1页
《VB实训报告》word版_第2页
《VB实训报告》word版_第3页
《VB实训报告》word版_第4页
《VB实训报告》word版_第5页
已阅读5页,还剩16页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、精品.湖南工业职业技术学院课程实训报告课程名称:课程名称: 姓姓 名:名: 学学 号:号: 专业班级:专业班级: 系系 (院):院): 设计时间:设计时间: 设计地点:设计地点: 指导教师评语: 签名: 成绩:成绩:精品.目录一一 实训目的实训目的 .2 2二二 实训内容实训内容 .2 2三三 实训步骤实训步骤 .2 23.1 数据库的设计 .23.2 界面设计 .33.3 报表设计.15四四 程序的调试和运行程序的调试和运行.1616五五 实训总结实训总结 .2020精品.一一 实训目的实训目的面向对象程序设计实训是电子商务及相关专业的实践环节之一,是学习完面向对象程序设计课程后进行的一次全

2、面的综合练习。其目的在于加深对面向对象可视化程序设计基本概念的理解,掌握应用 VB6.0 设计应用程序的基本方法和基本技能,提高学生的实践动手能力。二二 实训内容实训内容设计一个小型学生成绩管理系统,功能模块包括:系统管理、成绩管理、成绩统计、报表管理等模块。1. 用户管理:实现用户的添加、删除、密码修改、用户登录等功能。2. 成绩管理:实现学生的成绩录入、修改、删除、查询和浏览3. 成绩的统计:可以实现课程的平均分,总分,最低分和最高分;统计每个学生的总分,并求出考试总成绩的最高分好最低分。4. 报表管理:可以打印学生的成绩和用户信息。三三 实训步骤实训步骤3.13.1 数据库的设计数据库的

3、设计数据库中包含 2 个表,user 表和成绩表。1 1) user 表的设计2)字段名称数据类型字段大小ID(主键)自动编号长整型user文本20pass文本50level文本2 2) user 表的内容精品.2 1)成绩表的设计 字段名称数据类型字段大小学号(主键)文本20 xh文本10 xb文本4bj文本20database数字单精度型English数字单精度型vb数字单精度型flash数字单精度型zf数字单精度型 2)成绩表的内容精品.3.23.2 界面设计界面设计1 登陆界面的设计 控件名称属性属性值caption用户名称Label1font华文行楷 小四号caption用户密码La

4、bel2font华文行楷 小四号caption学生成绩管理系统Label3font华文新魏 粗体 小一号Text1, Text2text置空Command1caption确定Command2caption取消Frame1caption用户权限Option1caption系统管理员Option2caption普通用户databasename链接到相关数据库Data1Recordsettype0-tableRecordsourceUSERvisiblefalse该程序实现的代码是:该程序实现的代码是:Private Sub Command1_Click()If Data1.Recordset.Fi

5、elds(“user”).Value = Trim(Text1.Text) And Data1.Recordset.Fields(“pass”).Value = Trim(Text2.Text) ThenIf Option1.Value = True ThenEnd IfIf Option2.Value = True ThenMDIForm1.xinzeng.Enabled = FalseMDIForm1.shangchu.Enabled = FalseMDIForm1.lr.Enabled = FalseMDIForm1.bj.Enabled = FalseMDIForm1.tj.Enabl

6、ed = False精品.End IfExit DoElseEnd IfLoopIf Data1.Recordset.EOF = True ThenMsgBox (“用户名称或用户密码不正确,请重新输入”)Text1.Text = “”Text2.Text = “”End IfEnd SubPrivate Sub Command2_Click()EndEnd Sub2 新增用户界面控件名属性属性值caption请输入用户名Label1font华文行楷 小四号caption请输入密码Lable2Font华文行楷 小四号caption权限Lable3Font华文行楷 小四号caption新增用户F

7、ont华文宋体 三号Lable4Fontcolor红色Text1,text2,text3caption置空databasename链接到相关数据库RecordsourceUSERData1visiblefalseCommand1Caption添加Command2caption返回Command3caption取消MSFlexGrid1DatasourceData1该程序实现的代码是:该程序实现的代码是:Private Sub Command1_Click()End Sub精品.Private Sub Command2_Click()End SubPrivate Sub Command3_Cli

8、ck()Text1.Text = “”Text2.Text = “”Text3.Text = “”End Sub3 成绩编辑界面控件名属性属性值caption输入学号Label1font华文行楷 小四号caption学号Lable2Font华文行楷 小四号caption姓名Lable9Font华文行楷 小四号caption性别Lable3Font华文行楷 小四号caption班级Label4font华文行楷 小四号captiondatabaseLable5Font华文行楷 小四号captionenglishLable6Font华文行楷 小四号captionvbLable7Font华文行楷 小四

9、号captionflashLable8Font华文行楷 小四号Text1-text9caption置空Command1Caption查找Command2Caption修改Command3caption删除精品.Command4caption返回databasename链接到相关数据库RecordsourceCJBData1visiblefalse该程序实现的代码是:该程序实现的代码是:Private Sub Command1_Click()If Text1.Text = “” ThenMsgBox “学号不能为空,请重新输入!”, vbOKOnly + vbExclamation, “警告”E

10、lseData1.RecordSource = “select*from CJB where XH=”&text1.text&”If Data1.Recordset.EOF ThenMsgBox “学号不存在,请重新输入!”, vbOKOnly + vbExclamation, “警告”Text1.Text = “”Text2.Text = “”Text9.Text = “”Text3.Text = “”Text4.Text = “”Text5.Text = “”Text6.Text = “”Text7.Text = “”Text8.Text = “”ElseText2.Text = Data

11、1.Recordset.Fields(0)Text9.Text = Data1.Recordset.Fields(1)Text3.Text = Data1.Recordset.Fields(2)Text4.Text = Data1.Recordset.Fields(3)Text5.Text = Data1.Recordset.Fields(4)Text6.Text = Data1.Recordset.Fields(5)Text7.Text = Data1.Recordset.Fields(6)Text8.Text = Data1.Recordset.Fields(7)End IfEnd IfE

12、nd SubPrivate Sub Command2_Click()If Text1.Text = “” ThenMsgBox “请输入内容!”Else精品.MsgBox “修改成功”End IfEnd SubPrivate Sub Command3_Click()If Text2.Text = “” ThenMsgBox “请输入内容”Elsestr2$ = MsgBox(“是否删除当前记录?”, vbOKCancel, “删除当前记录”)If str2$ = vbOK ThenText1.Text = “”Text2.Text = “”Text9.Text = “”Text3.Text =

13、 “”Text4.Text = “”Text5.Text = “”Text6.Text = “”Text7.Text = “”Text8.Text = “”End IfEnd IfEnd SubPrivate Sub Command4_Click()End Sub4 成绩录入界面控件名属性属性值caption成绩录入Label1font华文宋体 三号caption学号Lable2Font华文行楷 小四号Lable3caption姓名精品.Font华文行楷 小四号caption性别Lable4Font华文行楷 小四号caption班级Label5font华文行楷 小四号captiondataba

14、seLable6Font华文行楷 小四号captionenglishLable7Font华文行楷 小四号captionvbLable8Font华文行楷 小四号captionflashLable9Font华文行楷 小四号Text1-text8caption置空Command1Caption新增Command2Caption取消Command3caption返回Command4caption|Command5captionCommand7caption|MSFlexGrid1DatasourceData1databasename链接到相关数据库RecordsourceCJBData1visible

15、false 该程序实现的代码是该程序实现的代码是; ;Private Sub Command1_Click()If Text1.Text = “” Or Text2.Text = “” Or Text3.Text = “” Or Text4.Text = “” Or Text5.Text = “” Or Text6.Text = “” Or Text7.Text = “” Or Text8.Text = “” ThenMsgBox “学号和姓名不能为空!”, vbOKOnly + vbExclamation, “警告”ElseData1.Recordset.Fields(“bj”) = Val

16、(Text4.Text)Data1.Recordset.Fields(“database”) = Val(Text5.Text)Data1.Recordset.Fields(“) = Val(Text6.Text)Data1.Recordset.Fields(“vb”) = Val(Text7.Text)Data1.Recordset.Fields(“flash”) = Val(Text8.Text)精品.MsgBox “记录已成功添加”End IfText1.Text = “”Text2.Text = “”Text3.Text = “”Text4.Text = “”Text5.Text =

17、“”Text6.Text = “”Text7.Text = “”Text8.Text = “”:End SubPrivate Sub Command2_Click()End SubPrivate Sub Command4_Click()End SubPrivate Sub Command5_Click()If Data1.Recordset.EOF ThenEnd IfEnd SubPrivate Sub Command6_Click()If Data1.Recordset.EOF ThenEnd IfEnd SubPrivate Sub Command7_Click()End Sub5 成绩

18、编辑界面控件名属性属性值Combo1text置空Text1text置空Command1Caption查询Command2Caption返回MSFlexGrid1DatasourceData1Data1databasename链接到相关数据库精品.RecordsourceCJBvisiblefalse该程序实现的代码是:该程序实现的代码是:Private Sub Command1_Click()If Combo1.Text = “学号” ThenData1.RecordSource = “select * from CJB where xh=” & Text1.Text & “”ElseIf C

19、ombo1.Text = “姓名” ThenData1.RecordSource = “select * from CJB where xm=” & Text1.Text & “”ElseData1.RecordSource = “select * from CJB where bj=” & Text1.Text & “”End IfEnd SubPrivate Sub Command2_Click()End Sub6 修改密码界面控件名称属性属性值caption修改密码Label1font华文宋体 三号caption原密码Label2font华文行楷 小四号caption请输入新密码Labe

20、l3font华文行楷 小四号caption请重新输入新密码Label4font华文行楷 小四号Text1, Text2text置空Command1caption确认Command2caption返回databasename链接到相关数据库RecordsourceUSERData1visiblefalse该程序实现的代码是:该程序实现的代码是:Private Sub Command1_Click()If Trim(Text3.Text = “”) Then MsgBox “原密码不能为空,请重新输入!”, vbOKOnly + vbExclamation, “警告” Text3.Text = “

21、”精品. Exit SubEnd IfIf Trim(Text1.Text = “”) Then MsgBox “新密码不能为空,请重新输入!”, vbOKOnly + vbExclamation, “警告” Text1.Text = “” Exit SubEnd IfIf Trim(Text1.Text) Trim(Text2.Text) ThenMsgBox “密码输入不正确!”, vbOKOnly + vbExclamation, “警告”Text1.Text = “”ElseData1.RecordSource = “select * from User where user=and

22、pass = ” & Trim(Text1.Text) & “”MsgBox “密码修改成功!”, vbOKOnly + vbExclamation, “修改密码”Text1.Text = “”Text2.Text = “”Text3.Text = “”End IfEnd SubPrivate Sub Command2_Click()End Sub7 删除用户界面控件名属性属性值caption删除用户Label1font华文宋体 三号caption请输入用户名Lable2Font华文行楷 小四号Text1caption置空databasename链接到相关数据库RecordsourceUSER

23、Data1visiblefalse精品.Command1Caption删除Command2caption返回Command3caption取消MSFlexGrid1DatasourceData1该程序实现的代码是:该程序实现的代码是:Private Sub Command1_Click()If Text1.Text = “” ThenMsgBox “请输入内容!”, vbOKOnly + vbExclamation, “警告”Elsestr2$ = MsgBox(“是否删除当前记录?”, vbOKCancel, “删除当前记录”)If str2$ = vbOK ThenText1.Text =

24、 “”End IfEnd IfEnd SubPrivate Sub Command2_Click()End SubPrivate Sub Command3_Click()Text1.Text = “”End Sub8 成绩统计界面控件名属性属性值caption成绩统计Label17font华文宋体 三号caption最高分Lable2,Lable6, Lable11, Lable14Font华文行楷 小四号caption最低分Lable3, Lable7,Lable12, Lable15Font华文行楷 小四号caption平均分Lable4,Lable8Lable13,Lable16Font

25、华文行楷 小四号captiondatabaseLabel1font宋体 四号captionEnglishLable5Font宋体 四号captionVBLable9Font宋体 四号精品.captionflashLable10Font宋体 四号Text1-text14caption置空Command1Caption个人总分Command2caption返回MSFlexGrid1DatasourceData1databasename链接到相关数据库RecordsourceCJBData1visiblefalse9 关于对话框 方法是:工程添加窗体“关于”对话框。10 菜单窗体界面 方法是:添加一

26、个 MDIForm 后,进入工具菜单编辑器。菜单的一级标题是:菜单的二级标题是:1)系统管理:2)成绩管理:3)报表管理:4)帮助:该程序实现的代码是:该程序实现的代码是:Private Sub bj_Click()精品.End SubPrivate Sub chongxin_Click()End SubPrivate Sub cj_Click()End SubPrivate Sub cx_Click()End SubPrivate Sub gy_Click()End SubPrivate Sub lr_Click()End SubPrivate Sub shangchu_Click()End SubPrivate Sub tj_Click()End SubPrivate Sub tuichu_Click()EndEnd SubPrivate S

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论