学士学位论文vb课程设计题目设备管理系统.docx
《学士学位论文vb课程设计题目设备管理系统.docx》由会员分享,可在线阅读,更多相关《学士学位论文vb课程设计题目设备管理系统.docx(11页珍藏版)》请在冰点文库上搜索。
学士学位论文vb课程设计题目设备管理系统
VB程序设计
课程设计
课程设计题目
设备管理系统
目录
一、课程设计的目的与要求
二、任务描述
对系统要实现的功能进行确切的描述。
三、设计
详细说明程序的设计思想,所用到的算法、数据结构技巧等
四、效果及存在问题
说明系统的运行效果(附上界面图形)、存在哪些不足以及预期的解决办法
五、总结
课程设计的目的与要求
1、教学目的
使学生在理论课程结束后,通过课程设计能进一步巩固对VB编程机制的理解,真正掌握运用VB进行软件开发的方法和原理,从而锻炼学生开发能力、程序调试的能力,及程序错误处理的能力。
2、教学要求
从课程设计的目的出发,通过课程设计的各个环节,达到以下教学要求
(1)进一步掌握VB语言程序设计的基本思想和方法;
(2)掌握面向对象的可视化程序设计的基本原理及应用;
任务描述
建立设备数据库表,存储设备的信息,包括设备的名称、数量、型号、规格等信息;能够实现对设备的查询、修改、添加等操作。
设计
1、设备管理系统的功能
1、查看设备:
用来实现对设备的浏览、删除
2、查询设备:
用来实现对设备的查询
3、添加设备:
用来实现对设备的添加
2、连接数据源
利用ADO控件将Access数据源连接到程序中
建立Access数据库
打开Access,建立名为“设备”的数据库。
在数据库中选择“使用设计器创建表”输入名称、型号、单价、数量、规格、购买日期。
保存命名为“设备管理”。
3、窗体
名称
标题
From1
登陆界面
From2
查看设备
From3
添加设备
From4
查找设备
(1)登陆界面
From1代码如下:
PrivateSubCommand1_Click()
Form2.Show
EndSub
(2)查看设备
Form2代码如下:
PrivateSubCommand1_Click()
Adodc1.Recordset.MovePrevious’数据移到上一条
IfAdodc1.Recordset.BOFThen
Adodc1.Recordset.MoveFirst
MsgBox"已经是第一条"
EndIf
EndSub
PrivateSubCommand2_Click()
Adodc1.Recordset.MoveNext’数据移到下一条
IfAdodc1.Recordset.EOFThen
Adodc1.Recordset.MoveLast
MsgBox"已经是最后一条"
EndIf
EndSub
PrivateSubCommand3_Click()
Form3.Show
EndSub
PrivateSubCommand4_Click()
Form4.Show
EndSub
PrivateSubCommand5_Click()
OnErrorResumeNext
IfMsgBox("确定删除该记录?
",vbOKCancel,"提示")=vbOKThen
Adodc1.Recordset.Delete’删除正显示的记录
Adodc1.Recordset.MoveNext’显示下一条数据
IfAdodc1.Recordset.EOFThen
Adodc1.Recordset.MoveLast
EndIf
EndIf
EndSub
PrivateSubCommand6_Click()
End
EndSub
PrivateSubCommand7_Click()
Adodc1.Recordset.MoveFirst’显示第一条数据
EndSub
PrivateSubCommand8_Click()
Adodc1.Recordset.MoveLast’显示最后一条数据
EndSub
(3)添加设备
Form3代码如下:
PrivateSubCommand1_Click()
Adodc1.Refresh
Adodc1.Recordset.AddNew
Adodc1.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.Update
Adodc1.Recordset.MoveLast
MsgBox"该设备已添加"
EndSub
PrivateSubCommand2_Click()
Text1.Text=""
Text2.Text=""
Text3.Text=""
Text4.Text=""
Text5.Text=""
Text6.Text=""
EndSub
PrivateSubCommand3_Click()
UnloadMe
Form2.Show
EndSub
Form4代码如下:
PrivateSubCommand1_Click()
DimcheckAsInteger
Adodc1.Refresh
Adodc1.Recordset.MoveFirst
M=Trim(Text1)
WhileAdodc1.Recordset.EOF<>True
IfAdodc1.Recordset.Fields
(1)=MThen
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’用循环语句判断文本框中的
EndIf值是否等于数据库中相应
Adodc1.Recordset.MoveNext的值
Wend
Adodc1.Refresh
X=Trim(Text2)
WhileAdodc1.Recordset.EOF<>True
IfAdodc1.Recordset.Fields
(2)=XThen
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
EndIf
Adodc1.Recordset.MoveNext
Wend
Adodc1.Refresh
D=Val(Trim(Text3))
WhileAdodc1.Recordset.EOF<>True
IfAdodc1.Recordset.Fields(3)=DThen
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
EndIf
Adodc1.Recordset.MoveNext
Wend
Adodc1.Refresh
S=Val(Trim(Text4))
Adodc1.Recordset.MoveFirst
WhileAdodc1.Recordset.EOF<>True
IfAdodc1.Recordset.Fields(4)=SThen
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
EndIf
Adodc1.Recordset.MoveNext
Wend
Adodc1.Refresh
G=Trim(Text5)
WhileAdodc1.Recordset.EOF<>True
IfAdodc1.Recordset.Fields(5)=GThen
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
EndIf
Adodc1.Recordset.MoveNext
Wend
Adodc1.Refresh
R=Trim(Text6)
WhileAdodc1.Recordset.EOF<>True
IfAdodc1.Recordset.Fields(6)=RThen
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
EndIf
Adodc1.Recordset.MoveNext
Wend
Ifcheck=0Then
MsgBox("无此设备!
")
EndIf
Text1.Locked=True’显示查询结果后,文本框内容不可更改
Text2.Locked=True
Text3.Locked=True
Text4.Locked=True
Text5.Locked=True
Text6.Locked=True
EndSub
PrivateSubCommand2_Click()
Text1.Text=""
Text2.Text=""
Text3.Text=""
Text4.Text=""
Text5.Text=""
Text6.Text=""
Text1.Locked=False’按清除键后,文本框内容不可更改
Text2.Locked=False
Text3.Locked=False
Text4.Locked=False
Text5.Locked=False
Text6.Locked=False
EndSub
效果及存在问题
不能将添加的设备马上显示出来,功能较为简单,不够完善
总结
通过这次实验周的实践,我感受到了VB设计的趣味性,了解了VB的实用性。
虽然在实践时出现了许多问题,但通过老师和同学们的帮助,顺利的完成了课程设计,使我对VB有了进一步的认识,更渐渐喜欢上VB。