




已阅读5页,还剩6页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
VB程序设计课程设计课程设计题目设备管理系统 目 录一、课程设计的目的与要求二、任务描述对系统要实现的功能进行确切的描述。 三、设计 详细说明程序的设计思想,所用到的算法、数据结构技巧等四、效果及存在问题说明系统的运行效果(附上界面图形)、存在哪些不足以及预期的解决办法五、总结 课程设计的目的与要求1、教学目的使学生在理论课程结束后,通过课程设计能进一步巩固对VB编程机制的理解,真正掌握运用VB进行软件开发的方法和原理,从而锻炼学生开发能力、程序调试的能力,及程序错误处理的能力。 2、教学要求从课程设计的目的出发,通过课程设计的各个环节,达到以下教学要求(1)进一步掌握VB语言程序设计的基本思想和方法;(2)掌握面向对象的可视化程序设计的基本原理及应用; 任务描述建立设备数据库表,存储设备的信息,包括设备的名称、数量、型号、规格等信息;能够实现对设备的查询、修改、添加等操作。设计1、设备管理系统的功能 1、查看设备:用来实现对设备的浏览、删除2、查询设备:用来实现对设备的查询3、添加设备:用来实现对设备的添加2、连接数据源 利用ADO控件将Access数据源连接到程序中建立Access数据库打开Access,建立名为“设备”的数据库。在数据库中选择“使用设计器创建表”输入名称、型号、单价、数量、规格、购买日期。保存命名为“设备管理”。3、窗体名称标题From1登陆界面From2查看设备From3添加设备From4查找设备(1)登陆界面From1 代码如下:Private Sub Command1_Click()Form2.ShowEnd Sub(2)查看设备 Form2 代码如下:Private Sub Command1_Click()Adodc1.Recordset.MovePrevious 数据移到上一条If Adodc1.Recordset.BOF ThenAdodc1.Recordset.MoveFirstMsgBox 已经是第一条End IfEnd SubPrivate Sub Command2_Click()Adodc1.Recordset.MoveNext 数据移到下一条If Adodc1.Recordset.EOF ThenAdodc1.Recordset.MoveLastMsgBox 已经是最后一条End IfEnd SubPrivate Sub Command3_Click()Form3.ShowEnd SubPrivate Sub Command4_Click()Form4.ShowEnd SubPrivate Sub Command5_Click()On Error Resume Next If MsgBox(确定删除该记录?, vbOKCancel, 提示) = vbOK Then Adodc1.Recordset.Delete 删除正显示的记录 Adodc1.Recordset.MoveNext 显示下一条数据 If Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveLast End If End IfEnd SubPrivate Sub Command6_Click()EndEnd SubPrivate Sub Command7_Click()Adodc1.Recordset.MoveFirst 显示第一条数据End SubPrivate Sub Command8_Click()Adodc1.Recordset.MoveLast 显示最后一条数据End Sub (3)添加设备 Form3 代码如下:Private Sub Command1_Click()Adodc1.RefreshAdodc1.Recordset.AddNewAdodc1.Recordset.Fields(1) = Trim(Text1)Adodc1.Recordset.Fields(2) = Trim(Text2)Adodc1.Recordset.Fields(3) = Trim(Text3)Adodc1.Recordset.Fields(4) = Trim(Text4)Adodc1.Recordset.Fields(5) = Trim(Text5)Adodc1.Recordset.Fields(6) = Trim(Text6) 将文本框中的值赋值给数据库Adodc1.Recordset.UpdateAdodc1.Recordset.MoveLastMsgBox 该设备已添加End Sub Private Sub Command2_Click()Text1.Text = Text2.Text = Text3.Text = Text4.Text = Text5.Text = Text6.Text = End SubPrivate Sub Command3_Click()Unload MeForm2.ShowEnd SubForm4 代码如下:Private Sub Command1_Click()Dim check As IntegerAdodc1.RefreshAdodc1.Recordset.MoveFirstM = Trim(Text1)While Adodc1.Recordset.EOF True If Adodc1.Recordset.Fields(1) = M Then Text2.Text = Adodc1.Recordset.Fields(2) Text3.Text = Adodc1.Recordset.Fields(3) Text4.Text = Adodc1.Recordset.Fields(4) Text5.Text = Adodc1.Recordset.Fields(5) Text6.Text = Adodc1.Recordset.Fields(6) check = check + 1 用循环语句判断文本框中的 End If 值 是否等于数据库中相应 Adodc1.Recordset.MoveNext 的值 WendAdodc1.RefreshX = Trim(Text2)While Adodc1.Recordset.EOF True If Adodc1.Recordset.Fields(2) = X Then Text1.Text = Adodc1.Recordset.Fields(1) Text3.Text = Adodc1.Recordset.Fields(3) Text4.Text = Adodc1.Recordset.Fields(4) Text5.Text = Adodc1.Recordset.Fields(5) Text6.Text = Adodc1.Recordset.Fields(6) check = check + 1 End If Adodc1.Recordset.MoveNextWendAdodc1.RefreshD = Val(Trim(Text3)While Adodc1.Recordset.EOF True If Adodc1.Recordset.Fields(3) = D Then Text1.Text = Adodc1.Recordset.Fields(1) Text2.Text = Adodc1.Recordset.Fields(2) Text4.Text = Adodc1.Recordset.Fields(4) Text5.Text = Adodc1.Recordset.Fields(5) Text6.Text = Adodc1.Recordset.Fields(6) check = check + 1 End If Adodc1.Recordset.MoveNextWendAdodc1.RefreshS = Val(Trim(Text4)Adodc1.Recordset.MoveFirstWhile Adodc1.Recordset.EOF True If Adodc1.Recordset.Fields(4) = S Then Text1.Text = Adodc1.Recordset.Fields(1) Text2.Text = Adodc1.Recordset.Fields(2) Text3.Text = Adodc1.Recordset.Fields(3) Text5.Text = Adodc1.Recordset.Fields(5) Text6.Text = Adodc1.Recordset.Fields(6) check = check + 1 End If Adodc1.Recordset.MoveNextWendAdodc1.RefreshG = Trim(Text5)While Adodc1.Recordset.EOF True If Adodc1.Recordset.Fields(5) = G Then Text1.Text = Adodc1.Recordset.Fields(1) Text2.Text = Adodc1.Recordset.Fields(2) Text3.Text = Adodc1.Recordset.Fields(3) Text4.Text = Adodc1.Recordset.Fields(4) Text6.Text = Adodc1.Recordset.Fields(6) check = check + 1 End If Adodc1.Recordset.MoveNextWendAdodc1.RefreshR = Trim(Text6)While Adodc1.Recordset.EOF True If Adodc1.Recordset.Fields(6) = R Then Text1.Text = Adodc1.Recordset.Fields(1) Text2.Text = Adodc1.Recordset.Fields(2) Text3.Text = Adodc1.Recordset.Fields(3) Text4.Text = Adodc1.Recordset.Fields(4) Text5.Text = Adodc1.Recordset.Fields(5) check = check + 1 End If Adodc1.Recordset.MoveNextWendIf check = 0 Then MsgBox (无此设备!) End If Text1.Locked = True 显示查询结果后,文本框内容不可更改 Text2.Locked = True Text3.Locked = True Text4.Locked = True Text5.Locked = True Text6.Locked = TrueEnd SubPrivate Sub Command2_Click()Text1.Text = Text2.Text = Text3.Text = Text4.Text = Text5.Text = Text6.Text = Text1.Locked = False 按清除键后,文本框
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 5.5 诱导公式说课稿-2025-2026学年中职基础课-基础模块 上册-北师大版(2021)-(数学)-51
- 第十一课 我是小小排版员说课稿-2025-2026学年小学信息技术(信息科技)四年级上册川教版
- 二年级数学乘除法应用题训练
- 高校教学资源平台建设方案与实践
- 晚宴活动主持词写作指导
- 表单数据脱敏与加密的双重保护策略-洞察及研究
- 安全传感器数据融合-洞察及研究
- 泡腾片辅料智能化筛选方法-洞察及研究
- 中医药在运动疲劳中的应用-洞察及研究
- 嗜酸性细胞药物安全性评价-洞察及研究
- 等保测评项目技术方案
- 法治及其本土资源
- 《明朝那些事儿》读书分享PPT
- 沪教版(上海)初中数学九年级第一学期-25.3(2)-解直角三角形-课件-课件PPT
- 公出单(标准模版)
- 安全- 中国移动认证考试L1题库(附答案)
- 广告及宣传用品设计申请单
- LY/T 2988-2018森林生态系统碳储量计量指南
- 南航广州a320机队非正常程序流程扩展版
- 高效课堂教学模式培训(数学)课件
- Python基础课件(共282张PPT)
评论
0/150
提交评论