




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、仓库管理系统 项目的建立 这是本人利用闲暇之余在vb6.0上制作的一个简陋的类库管系统,现图文结合的方式一步一步展现制作过程。由于本人是个初学者,里面存在很多不足之处望得到高手们的指导。此文可作供初学者们学习交流。作者联系方式:e-mail luo.shiye qq:1355044347最终运行效果打开软件出现如下登录界面输入系统预设用户名及密码( 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”输入数据库名,“保存”出现如下图在数据窗口中右击“新建表”,最终如下往数据表里添加数据在这里就不罗嗦了,请查阅相关书籍。登录界面窗口的建立 最终界面如下:
3、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 请输入用户名!, , 登录信息
4、提示: 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 if adodc1.recordset.eof = false then msgbox 您输入的用户已存在!, , 登录提示信息: text1.text
5、= 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 两次输入的密码不一致,请确认!, , 登录提示信息: te
6、xt2.text = text3.text = text2.setfocus exit sub else adodc1.recordset.addnew 添加新用户 adodc1.recordset.fields(用户名) = trim(text1.text) adodc1.recordset.fields(密码) = trim(text2.text) adodc1.recordset.update msgbox (添加新用户成功,现在您可以登陆系统了!) label3.visible = false text3.visible = false command1.caption = 登录 co
7、mmand2.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 if adodc1.recordset.eof = true then msg
8、box 用户名不存在,请重新输入!, , 登录提示信息: text1.text = text2.text = text1.setfocus exit sub end if if adodc1.recordset.fields(密码) = trim(text2.text) then 检测密码是否正确 form1.hide unload me form2.show msgbox 登陆成功!, , 登录提示信息: else msgbox 密码不正确,请重新输入!, , 登录提示信息: text2.text = text2.setfocus end if end ifend subprivate su
9、b 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 = tr
10、ue 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
11、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 = fo
12、rm1.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
13、 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 出
14、库表 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 经手人 = & j
15、shr & 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 =
16、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
17、提示用户输入用户名 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 if adodc1.recordset.eof = false then msgbox 您
18、输入的用户已存在!, , 登录提示信息: 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 msgb
19、ox 两次输入的密码不一致,请确认!, , 登录提示信息: text2.text = text3.text = text2.setfocus exit sub else adodc1.recordset.addnew 添加新用户 adodc1.recordset.fields(用户名) = trim(text1.text) adodc1.recordset.fields(密码) = trim(text2.text) adodc1.recordset.update dim x as integer x = msgbox(成功添加新用户,是否要重新登录!, vbyesno + vbquestion
20、 + 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
21、 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() textusername = t
22、rim(form1.text1.text) 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
23、 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 = s
24、elect * 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 归还日期 = &
25、 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
26、= 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(
27、) 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 x
28、h = 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 借出人
29、= & 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
30、 = 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 = 归还
31、信息 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
32、(经手人, 请输入, 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 & adodc
33、2.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 & adodc
34、2.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.recordso
35、urce = 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
36、 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
37、 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
38、.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 l
39、abel7.left - 80 else label7.left = form2.scalewidth end ifend subprivate sub xgmm_click() form2.hide form4.showend sub private 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 & a
40、dodc2.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 a
41、dodc2.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 = 80
42、0 .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 =
43、 学分 .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 su
44、b 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 if adodc1.recordset.eof = true then msgbox 用户名不存在,请重新输入!, , 登录提示信息: text1.text = text2.text =
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
评论
0/150
提交评论