




已阅读5页,还剩17页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
仓库管理系统项目的建立 这是本人利用闲暇之余在VB6.0上制作的一个简陋的类库管系统,现图文结合的方式一步一步展现制作过程。由于本人是个初学者,里面存在很多不足之处望得到高手们的指导。此文可作供初学者们学习交流。作者联系方式:E-mail 最终运行效果打开软件出现如下登录界面输入系统预设用户名及密码( 1 1 )单击“登录”或单击“新用户”添加新用户进入如下主界面:建立工程1、 创建标准EXE2、 按“打开”3、 添加MDI窗体打开4、 编辑菜单在空白处右击点击“菜单编辑器”在“标题”里输入“系统”,在“名称”里输入“Sys”(注意此处不能为汉字)点击“下一个”再点击“ ”“确定”退到MDI界面点击“系统”“退出”如下,然后编写代码。代码如下: Private Sub Exit_Click() EndEnd Sub数据库的建立VB6.0中可以创建Access数据库。如下建立一个“用户表”的数据库,用来存放用户信息及一些出入库管理信息。如下图单击“外接程序”再单击“可视化数据管理器”出现如图点击“文件”“新建”“Microsoft Access”“Version 2.0 MDB”输入数据库名,“保存”出现如下图在数据窗口中右击“新建表”,最终如下往数据表里添加数据在这里就不罗嗦了,请查阅相关书籍。登录界面窗口的建立 最终界面如下:1、Adodc1的添加过程为:单击“工程”“部件”出现下图所示,选择“控件”下的“Microsoft ADO Data Control 6.0 (OLEDB)” 单击“确定”在工具栏中会出现“”图标,单击它并拖动到相应位置即可。其它元件不在一一说明。2、 本窗体代码如下:Private Sub Command1_Click() “登录”、“确定”按钮 If Command1.Caption = 确定 And Command2.Caption = 取消 Then 如果为“确定”则添加新用户 If Text1.Text = Then 提示用户输入用户名 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.RecordSource = strS Adodc1.Refresh MsgBox 您输入的用户已存在!, , 登录提示信息: Text1.Text = Text2.Text = 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.SetFocus Exit Sub End If If Text2.Text Text3.Text Then MsgBox 两次输入的密码不一致,请确认!, , 登录提示信息: Text2.Text = Text3.Text = Text2.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) 检测用户名是否存在 strSelect = select 密码 from 用户登录信息表 where 用户名 = & strSno & Adodc1.CommandType = adCmdText Adodc1.RecordSource = strSelect Adodc1.Refresh MsgBox 用户名不存在,请重新输入!, , 登录提示信息: Text1.Text = Text2.Text = Text1.SetFocus Exit 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 = 取消 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.Visible = 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 SubPrivate 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 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 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.RecordSource = 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.CommandType = 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 经手人 = & 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, 请输入, 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 出库表 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 As String usename = Trim(Text1.Text) strS = select * from 用户登录信息表 where 用户名= & usename & Adodc1.CommandType = adCmdText Adodc1.RecordSource = strS Adodc1.Refresh MsgBox 您输入的用户已存在!, , 登录提示信息: Text1.Text = Text2.Text = 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.SetFocus 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, 提示信息!) 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 = 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 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 Form8.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 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 Adodc2.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 & 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 型号 = & 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 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 & 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 型号 = & 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 = select * 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/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 = 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 归还表 where 经手人 = & 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 = 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(产品名, 请输入, 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 = 入库信息 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_Click() 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 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.CommandType = 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 型号 = & 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 Adodc2.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 = 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.Hide 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 & Adodc2.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 品名 = & 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 .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 Sub 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(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 = select 密码 from 用户登录信息表 where 用户名 = & strSno & Adodc1.CommandType = adCmdText Adodc1.RecordSource = strSelect Adodc1.Refresh MsgBox 用户名不存在,请重新输入!, , 登录提示信息: Text1.Text = Text2.Text = Text1.SetFocus Exit Sub End If 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.Text) 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 & 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
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025广西来宾市水库移民工作管理局招聘2人考前自测高频考点模拟试题及1套参考答案详解
- 2025年大庆油田有限责任公司春季高校毕业生招聘考前自测高频考点模拟试题及答案详解(历年真题)
- 2025昆明市晋宁区应急管理局招聘编外工作人员(1人)考前自测高频考点模拟试题带答案详解
- 2025国家文物局考古研究中心招聘专业技术人员11人模拟试卷及答案详解(名师系列)
- 2025福建三明市清流县金星园建设发展有限公司招聘消防驾驶员2人考前自测高频考点模拟试题及答案详解(考点梳理)
- 2025桂林银行校园招聘考前自测高频考点模拟试题(含答案详解)
- 2025年东方地球物理勘探有限责任公司招聘(25人)模拟试卷及答案详解1套
- 2025广东肇庆市鼎湖区就业困难人员(脱贫劳动力)公益性岗位招聘1人模拟试卷及答案详解(典优)
- 2025江苏张家港检验认证有限公司招聘1人考前自测高频考点模拟试题及完整答案详解
- 2025年泉州供电服务有限公司招聘64人模拟试卷附答案详解(典型题)
- 包装材质基础知识培训课件
- 2025至2030中国生产监控行业项目调研及市场前景预测评估报告
- 养老护理员学习汇报
- (新人教PEP版)英语五年级上册全册大单元教学设计
- 小儿急性阑尾炎护理查房
- 2025-2030中国锆铪行业市场发展趋势与前景展望战略研究报告
- 专业英语翻译教学设计
- 围棋入门教案
- 煤矿安全规程培训课件
- 中药硬膏热贴敷治疗
- 经济与社会 思维导图式复习课件高中政治统编版必修二经济与社会
评论
0/150
提交评论