




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、精心整理仓库管理系统项目的建立 这是本人利用闲暇之余在VB6.0上制作的一个简陋的类库管系统,现图文结合的方式一步一步展现制作过程。由于本人是个初学者,里面存在很多不足之处望得到高手们的指导。此文可作供初学者们学习交流。作者联系方式:E-mail 最终运行效果打开软件出现如下登录界面输入系统预设用户名及密码( 1 1 )单击“登录”或单击“新用户”添加新用户进入如下主界面:建立工程1、 创建标准EXE2、 按“打开”3、 添加MDI窗体打开4、 编辑菜单在空白处右击点击“菜单编辑器”在“标题”里输入“系统”,在“名称”里输入“Sys”(注意此处不能为汉字)点击“下一个”再点击“ ”“确定”退到
2、MDI界面点击“系统”“退出”如下,然后编写代码。代码如下: Private Sub Exit_Click() EndEnd Sub数据库的建立VB6.0中可以创建Access数据库。如下建立一个“用户表”的数据库,用来存放用户信息及一些出入库管理信息。如下图单击“外接程序”再单击“可视化数据管理器”出现如图点击“文件”“新建”“Microsoft Access”“Version 2.0 MDB”输入数据库名,“保存”出现如下图在数据窗口中右击“新建表”,最终如下往数据表里添加数据在这里就不罗嗦了,请查阅相关书籍。登录界面窗口的建立 最终界面如下:1、Adodc1的添加过程为:单击“工程”“部
3、件”出现下图所示,选择“控件”下的“Microsoft ADO Data Control 6.0 (OLEDB)” 单击“确定”在工具栏中会出现“”图标,单击它并拖动到相应位置即可。其它元件不在一一说明。2、 本窗体代码如下:Private Sub Command1_Click() '“登录”、“确定”按钮 If Command1.Caption = "确定" And Command2.Caption = "取消" Then '如果为“确定”则添加新用户 If Text1.Text = "" Then '提示用
4、户输入用户名 MsgBox "请输入用户名!", , "登录信息提示:" Exit Sub Else ' Dim usename As String '检测用户名是否已经存在 Dim strS As String usename = Trim(Text1.Text) strS = "select * from 用户登录信息表 where 用户名='" & usename & "'" Adodc1.CommandType = adCmdText Adodc1.Recor
5、dSource = strS Adodc1.Refresh MsgBox "您输入的用户已存在!", , "登录提示信息:" Text1.Text = "" Text2.Text = "" Text3.Text = "" Text1.SetFocus Exit Sub End If End If If Text2.Text = "" Then '提示用户密码不能为空 MsgBox "密码不能为空!", , "登录提示信息:" T
6、ext2.SetFocus Exit Sub End If If Text3.Text = "" Then MsgBox "请再次输入密码!", , "登录提示信息:" Text3.SetFocus Exit Sub End If If Text2.Text <> Text3.Text Then MsgBox "两次输入的密码不一致,请确认!", , "登录提示信息:" Text2.Text = "" Text3.Text = "" Text2
7、.SetFocus Exit Sub Else MsgBox ("添加新用户成功,现在您可以登陆系统了!") Label3.Visible = False Text3.Visible = False Command1.Caption = "登录" Command2.Caption = "退出" End If Else '“登录”按钮,用户登录 Dim strSno As String Dim strSelect As String strSno = Trim(Text1.Text) '检测用户名是否存在 strSele
8、ct = "select 密码 from 用户登录信息表 where 用户名 = '" & strSno & "'" Adodc1.CommandType = adCmdText Adodc1.RecordSource = strSelect Adodc1.Refresh MsgBox "用户名不存在,请重新输入!", , "登录提示信息:" Text1.Text = "" Text2.Text = "" Text1.SetFocus Exit
9、 Sub End If Form1.Hide 'Unload Me Form2.Show 'MsgBox "登陆成功!", , "登录提示信息:" Else MsgBox "密码不正确,请重新输入!", , "登录提示信息:" Text2.Text = "" Text2.SetFocus End If End IfEnd SubPrivate Sub Command2_Click() '“退出”或“取消”按钮 If Command2.Caption = "取消&
10、quot; Then Label3.Visible = False Text3.Visible = False Command1.Caption = "登录" Command2.Caption = "退出" Text1.Text = "" Text2.Text = "" Text1.SetFocus Else End 'Unload Me End IfEnd SubPrivate Sub Command3_Click() '“新用户”按钮 Label3.Visible = True Text3.Vi
11、sible = True Text1.Text = "" Text2.Text = "" Text3.Text = "" Command1.Caption = "确定" Command2.Caption = "取消" Text1.SetFocusEnd SubPrivate Sub Command3_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Label6.Visible = TrueEnd S
12、ubPrivate Sub Command3_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) Label6.Visible = FalseEnd SubPrivate Sub Form_Load() Label3.Visible = False Text3.Visible = FalseEnd SubPrivate Sub Timer1_Timer() '时间time1控件的time事件代码,用来 '显示向左移动的欢迎字幕 If Label4.Left + Label4.Width &
13、gt; 0 Then '当标签右边位置大于0时,标签向左移 Label4.Move Label4.Left - 80 Else '否则标签从头开始 Label4.Left = Form1.ScaleWidth End If If Label5.Left + Label5.Width > 0 Then Label5.Move Label5.Left - 80 Else Label5.Left = Form1.ScaleWidth End IfEnd Sub主界面窗体如下:代码: Private Sub AddNew_Click() Frame1.Visible = True
14、 Frame2.Visible = FalseEnd SubPrivate Sub CHKPMCHX_Click() Frame2.Caption = "出库信息" Dim pm As String Dim n As String pm = InputBox("产品名", "请输入", 0) n = "select * from 出库表 where 品名 = '" & pm & "'" Adodc2.CommandType = adCmdText Adodc2.R
15、ecordSource = n Adodc2.Refresh Call InitGrid1End SubPrivate Sub CHKXHCHX_Click() Frame2.Caption = "出库信息" Dim XH As String Dim n As String XH = InputBox("产品型号", "请输入", 0) n = "select * from 出库表 where 型号 = '" & XH & "'" Adodc2.CommandTy
16、pe = adCmdText Adodc2.RecordSource = n Adodc2.RefreshEnd SubPrivate Sub CKCZ_Click() 'Form2.Hide Form6.ShowEnd SubPrivate Sub CKJSHR_Click() Frame2.Caption = "出库信息" Dim JSHR As String Dim n As String JSHR = InputBox("经手人", "请输入", 0) n = "select * from 出库表 where
17、 经手人 = '" & JSHR & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh Call InitGrid1End SubPrivate Sub CKSHJ_Click() Frame2.Caption = "出库信息" Dim CHKRQ As String Dim n As String CHKRQ = InputBox("出库日期,格式为:月/日/年 如:12/1/2011", &q
18、uot;请输入", 0) n = "select * from 出库表 where 出库日期 = '" & CHKRQ & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh Call InitGrid1End SubPrivate Sub CKZCX_Click() Frame2.Caption = "出库信息" Dim ZB As String ZB = "select * from
19、出库表 " Adodc2.CommandType = adCmdText Adodc2.RecordSource = ZB Adodc2.Refresh Call InitGrid1End SubPrivate Sub Command1_Click() If Text1.Text = "" Then '提示用户输入用户名 MsgBox "请输入用户名!", , "登录信息提示:" Exit Sub Else ' Dim usename As String '检测用户名是否已经存在 Dim strS A
20、s String usename = Trim(Text1.Text) strS = "select * from 用户登录信息表 where 用户名='" & usename & "'" Adodc1.CommandType = adCmdText Adodc1.RecordSource = strS Adodc1.Refresh MsgBox "您输入的用户已存在!", , "登录提示信息:" Text1.Text = "" Text2.Text = &quo
21、t;" Text3.Text = "" Text1.SetFocus Exit Sub End If End If If Text2.Text = "" Then '提示用户密码不能为空 MsgBox "密码不能为空!", , "登录提示信息:" Text2.SetFocus Exit Sub End If If Text3.Text = "" Then MsgBox "请再次输入密码!", , "登录提示信息:" Text3.SetFo
22、cus Exit Sub End If If Text2.Text <> Text3.Text Then MsgBox "两次输入的密码不一致,请确认!", , "登录提示信息:" Text2.Text = "" Text3.Text = "" Text2.SetFocus Exit Sub Elsee Dim X As Integer X = MsgBox("成功添加新用户,是否要重新登录!", vbYesNo + vbQuestion + vbDefaultButton1, &q
23、uot;提示信息!") If X = vbYes Then Unload Me Form3.Show End If 'MsgBox ("成功添加新用户!") 'Label3.Visible = False 'Text3.Visible = False 'Command1.Caption = "登录" 'Command2.Caption = "退出" End If Frame1.Visible = False Frame2.Visible = True Text1.Text = &quo
24、t;" Text2.Text = "'" Text3.Text = "" 'Form3.ShowEnd SubPrivate Sub Command2_Click() Frame1.Visible = False Frame2.Visible = TrueEnd SubPrivate Sub CXDL_Click() Form3.Show 'Unload MeEnd SubPrivate Sub Exit_Click() End Unload Form1 Unload Form2 Unload Form3 Unload
25、Form4 Unload Form5 Unload Form6 Unload Form7 Unload Form8End SubPrivate Sub Form_Load() Unload Form1 Frame1.Visible = False Call InitGrid0 Me.Height = MDIForm1.Height - 1060 Me.Width = MDIForm1.Width - 560 Me.Top = MDIForm1.Top Me.Left = MDIForm1.LeftEnd SubPrivate Sub GHCZ_Click() 'Form2.Hide F
26、orm8.ShowEnd SubPrivate Sub GHPMCX_Click() Frame2.Caption = "归还信息" Dim pm As String Dim n As String pm = InputBox("产品名", "请输入", 0) n = "select * from 归还表 where 品名 = '" & pm & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n
27、Adodc2.Refresh Call InitGrid2End SubPrivate Sub GHRCX_Click() Frame2.Caption = "归还信息" Dim JCR As String Dim n As String JCR = InputBox("归还人", "请输入", 0) n = "select * from 归还表 where 归还人 = '" & JCR & "'" Adodc2.CommandType = adCmdText A
28、dodc2.RecordSource = n Adodc2.Refresh Call InitGrid2End SubPrivate Sub GHSJCX_Click() Frame2.Caption = "归还信息" Dim JCRQ As String Dim n As String JCRQ = InputBox("归还日期,格式为:月/日/年 如:12/1/2011", "请输入", 0) n = "select * from 归还表 where 归还日期 = '" & JCRQ &
29、 "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh Call InitGrid2End SubPrivate Sub GHXHCX_Click() Frame2.Caption = "归还信息" Dim XH As String Dim n As String XH = InputBox("产品型号", "请输入", 0) n = "select * from 归还表 where 型号 = '
30、" & XH & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh Call InitGrid2End SubPrivate Sub GHZCX_Click() Frame2.Caption = "归还信息" Dim ZB As String ZB = "select * from 归还表 " Adodc2.CommandType = adCmdText Adodc2.RecordSource = ZB
31、Adodc2.Refresh Call InitGrid2End SubPrivate Sub JCCZ_Click() 'Form2.Hide Form7.ShowEnd SubPrivate Sub JCHPMCHX_Click() Frame2.Caption = "借出信息" Dim pm As String Dim n As String pm = InputBox("产品名", "请输入", 0) n = "select * from 借出表 where 品名 = '" & pm
32、 & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh Call InitGrid2End SubPrivate Sub JCHXHCHX_Click() Frame2.Caption = "借出信息" Dim XH As String Dim n As String XH = InputBox("产品型号", "请输入", 0) n = "select * from 借出表 where 型号
33、 = '" & XH & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh Call InitGrid2End SubPrivate Sub JCRCX_Click() Frame2.Caption = "借出信息" Dim JCR As String Dim n As String JCR = InputBox("借出人", "请输入", 0) n = "selec
34、t * from 借出表 where 借出人 = '" & JCR & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh Call InitGrid2End SubPrivate Sub JCSHJCX_Click() Frame2.Caption = "借出信息" Dim JCRQ As String Dim n As String JCRQ = InputBox("借出日期,格式为:月/日/年 如:12
35、/1/2011", "请输入", 0) n = "select * from 借出表 where 借出日期 = '" & JCRQ & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh Call InitGrid2End SubPrivate Sub JCZCX_Click() Frame2.Caption = "借出信息" Dim ZB As String ZB = &quo
36、t;select * from 借出表 " Adodc2.CommandType = adCmdText Adodc2.RecordSource = ZB Adodc2.Refresh Call InitGrid2End SubPrivate Sub JSHRCHX_Click() Frame2.Caption = "归还信息" Dim JSHR As String Dim n As String JSHR = InputBox("经手人", "请输入", 0) n = "select * from 归还表 whe
37、re 经手人 = '" & JSHR & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh Call InitGrid2End SubPrivate Sub JSHRCX_Click() Frame2.Caption = "借出信息" Dim JSHR As String Dim n As String JSHR = InputBox("经手人", "请输入", 0) n =
38、"select * from 借出表 where 经手人 = '" & JSHR & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh Call InitGrid2End SubPrivate Sub PMCX_Click() Frame2.Caption = "库存信息" Dim pm As String Dim n As String pm = InputBox("产品名", &qu
39、ot;请输入", 0) n = "select * from 库存表 where 品名 = '" & pm & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh Call InitGrid0End SubPrivate Sub RKCZ_Click() 'Form2.Hide Form5.ShowEnd SubPrivate Sub RKJSHR_Click() Frame2.Caption = "
40、入库信息" Dim JSHR As String Dim n As String JSHR = InputBox("经手人", "请输入", 0) n = "select * from 入库表 where 经手人 = '" & JSHR & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh Call InitGrid1End SubPrivate Sub RKPMCHX_Cli
41、ck() Frame2.Caption = "入库信息" Dim pm As String Dim n As String pm = InputBox("产品名", "请输入", 0) If Len(pm) > 0 Then n = "select * from 入库表 where 品名 = '" & pm & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh
42、End If Call InitGrid1End SubPrivate Sub RKSHJ_Click() Frame2.Caption = "入库信息" Dim RKRQ As String Dim n As String RKRQ = InputBox("入库日期,格式为:月/日/年 如:12/1/2011", "请输入", 0) n = "select * from 入库表 where 入库日期 = '" & RKRQ & "'" Adodc2.Comman
43、dType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh Call InitGrid1End SubPrivate Sub RKXHCHX_Click() Frame2.Caption = "入库信息" Dim XH As String Dim n As String XH = InputBox("产品型号", "请输入", 0) If Len(XH) > 0 Then n = "select * from 入库表 where 型号 = '" &
44、amp; XH & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh End If Call InitGrid1End SubPrivate Sub RKZCX_Click() Frame2.Caption = "入库信息" Dim ZB As String ZB = "select * from 入库表 " Adodc2.CommandType = adCmdText Adodc2.RecordSource = ZB A
45、dodc2.Refresh Call InitGrid1End SubPrivate Sub Timer1_Timer() If Label4.Left + Label4.Width > 0 Then '当标签右边位置大于0时,标签向左移 Label4.Move Label4.Left - 80 Else '否则标签从头开始 Label4.Left = Form2.ScaleWidth End If If Label5.Left + Label5.Width > 0 Then Label5.Move Label5.Left - 80 Else Label5.Left
46、 = Form2.ScaleWidth End If If Label6.Left + Label6.Width > 0 Then Label6.Move Label6.Left - 80 Else Label6.Left = Form2.ScaleWidth End If If Label7.Left + Label7.Width > 0 Then Label7.Move Label7.Left - 80 Else Label7.Left = Form2.ScaleWidth End IfEnd SubPrivate Sub XGMM_Click() 'Form2.Hid
47、e Form4.ShowEnd SubPrivate Sub XHCX_Click() Frame2.Caption = "库存信息" Dim XH As String Dim n As String XH = InputBox("产品型号", "请输入", 0) If Len(XH) > 0 Then 'And Val(XH) <> 0 n = "select * from 库存表 where 型号 = '" & XH & "'" Ad
48、odc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh End If Call InitGrid0End SubPrivate Sub ZB_Click() Frame2.Caption = "库存信息" Dim ZB As String 'Dim N As String 'PM = InputBox("产品名", "请输入", 0) ZB = "select * from 库存表 " 'where 品名 = &
49、#39;" & PM & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = ZB Adodc2.Refresh Call InitGrid0End SubPrivate Sub InitGrid0() With DataGrid1 .Columns(0).Width = 1600 .Columns(1).Width = 2200 .Columns(2).Width = 2200 .Columns(3).Width = 1000 .Columns(4).Width = 1000
50、.Columns(5).Width = 4000 End WithEnd SubPrivate Sub InitGrid1() With DataGrid1 .Columns(0).Width = 800 .Columns(1).Width = 1600 .Columns(2).Width = 1600 .Columns(3).Width = 800 .Columns(4).Width = 800 .Columns(5).Width = 1000 .Columns(6).Width = 800 .Columns(7).Width = 4000 End WithEnd SubPrivate Su
51、b InitGrid2() With DataGrid1 '.Columns(0).Caption = "学号" ' .Columns(1).Caption = "课程名" '.Columns(2).Caption = "学分" ' .Columns(3).Caption = "成绩" '设置DtgCond的列宽 .Columns(0).Width = 800 .Columns(1).Width = 1600 .Columns(2).Width = 1600 .Columns
52、(3).Width = 800 .Columns(4).Width = 800 .Columns(5).Width = 800 .Columns(6).Width = 1000 .Columns(7).Width = 800 .Columns(8).Width = 4000 End WithEnd Sub用户重新登录界面 代码: Private Sub Command1_Click() Dim strSno As String Dim strSelect As String strSno = Trim(Text1.Text) '检测用户名是否存在 strSelect = "s
53、elect 密码 from 用户登录信息表 where 用户名 = '" & strSno & "'" Adodc1.CommandType = adCmdText Adodc1.RecordSource = strSelect Adodc1.Refresh MsgBox "用户名不存在,请重新输入!", , "登录提示信息:" Text1.Text = "" Text2.Text = "" Text1.SetFocus Exit Sub End If
54、Unload Me Form2.Show 'MsgBox "登陆成功!", , "登录提示信息:" Else MsgBox "密码不正确,请重新输入!", , "登录提示信息:" Text2.Text = "" Text2.SetFocus End IfEnd SubPrivate Sub Command2_Click() Unload Me Form2.ShowEnd Sub修改用户密码界面代码: Private Sub Command1_Click() If Trim(Text1.T
55、ext) <> Form2.TextUserName Then MsgBox "用户名不正确,请确认!", , "信息提示!" Text1.Text = "" Text1.SetFocus Exit Sub Else Dim name As String Dim names As String name = Trim(Text1.Text) names = "select * from 用户登录信息表 where 用户名='" & name & "'"
56、 Adodc1.CommandType = adCmdText Adodc1.RecordSource = names Adodc1.Refresh If Text2.Text = "" Then MsgBox "请输入旧密码!", , "信息提示!" Text2.SetFocus Exit Sub End If MsgBox "旧密码不正确,请确认!", , "信息提示!" Text2.Text = "" Text2.SetFocus Exit Sub End If If Text3.Text = "" Then MsgBox "请输入新密码!", , "信息提示!" Text3.SetFocus Exit Sub End If If Text4.Text = "" Then MsgBox "请再次输入新密码!", , "信息提示!" Text4.SetFocus Exit S
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025正规的公寓式商品房租赁合同样本
- 皮脂腺异位医学科普
- 生命支持类设备管理
- 班级布置专项培训方案
- 透析患者水分控制的管理
- 房地产电商营销模式研究报告(专业版)
- 2025年通勤驾驶员安全培训试题
- 第二课时:数字的变化规律教学设计
- 认识新质生产力
- 物理化学电子教案-第十一章
- 2025年护士考试心理健康试题及答案
- 旅游法规教程试题及答案
- 2025届天津市十二区重点学校高三下学期毕业联考(一)英语试题(含答案)
- 《陆上风电场工程概算定额》NBT 31010-2019
- 生物医学电子学智慧树知到期末考试答案章节答案2024年天津大学
- 干部人事档案转递单表样
- 关于中国文化遗产北京故宫的资料
- 2023年版一级建造师-水利工程实务电子教材
- 新中考考试平台-考生端V2.0使用手册
- 诊所备案申请表格(卫健委备案)
- 水上交通事故报告书(英文)
评论
0/150
提交评论