通讯录VB说明书
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Visual Basic
课程设计
中国移动积分管理系统
指导教师: 王丽
班级:园艺051
设计者: 戚宝永关旭设计时间: 2006年 9月
目录
一.需求分析 (2)
二.组员分工 (2)
三.系统框架图 (2)
四.程序运行平台 (2)
五.每个窗体设计分析 (3)
六.存在的问题与不足及对策 (7)
七.使用说明(操作手册) (7)
八.窗体代码 (7)
九、结束语 (23)
一.需求分析
当今社会是信息时代,手机已经成了人们必备品,当然在手机的背后肯定也有许多与之配合的软件系统,我们这个中国移动积分管理系统就可以帮助移动公司管理他们的积分活动。
二.组员分工
戚宝永:积分显示,管理员登陆窗体,查找窗体和欢迎窗体
关旭:修改窗体,删除窗体,添加窗体和标准模块
三.系统框架图
四.程序运行平台
windows操作环境
86DX/66MHz或更高的处理器
256MB或更高的内存
硬盘(至少要有30MB以上的空间)
VGA或更高分辨率的彩色显示器
VB6.0环境系统
五.每个窗体设计分析
欢迎进入窗体:此窗体有四个命令按钮:积分排名,管理员,帮助,退出,还有两个菜单项,项目和帮助,项目下还有积分排名和管理员。
这一窗体是用户和管理员进入的关口,所以必须有用户和管理员进入
的通道故按放积分排名和管理员两个按钮。
查找窗体:此窗体有三个标签,四个文本框和四个命令按钮。
当然这是一个方便用户和管理员查看的软件所以需要一个查找窗体。
通过在文本框中输入手机号码或是用户姓名就可以进行查找。
添加窗体:此窗体有八个标签,七个文本框和两个命令按钮。
为了方便管理员增添新的用户故设计这个添加窗体。
同样为了方便管理员管理用户的信息而设计这个删除窗体。
修改窗体:此窗体有八个标签,七个文本框和四个命令按钮
同样是为了方便管理员管理用户的信息而设计了这个修改窗体。
管理员登陆窗体:此窗体有两个标签,两个文本框和三个命令按钮为了系统的安全不是所有的人可以进入管理员后台操作的,所以设计管理员登陆窗体确定是否为
管理员,不是管理员就不能进入。
积分显示和编辑窗体:此窗体有一个命令按钮和两个菜单项,编辑和帮助,在编辑下还有修改、添加、查找、删除(管理员进入的积分显示窗体)或有查找和退出
(用户进入的积分显示窗体)
为了方便用户和管理查看用户和信息,同时也可以在此界面进入用户的查找
窗体和管理员的添加,修改及删除窗体。
六.存在的问题与不足及对策
该程序在输入用户的缴费积分后不能自动的生成其它各项积分。
在添加和修改窗体中不能通过输入用户姓名或手机号码来找到具体的用户资料而要进行上下查找之后才能进行添加和修改操作。
七.使用说明(操作手册)
如果是用户则在欢迎登陆界面中选积分排名,进入积分排名显示界面,察看用户的各项信息,如果需要进行某个用户的查找可以选查找任意一个已存储的用户信息。
如果是管理员则在欢迎登陆界面中选管理员项进入排名显示窗体,如果管理员要进行删除操作则选删除项,进入删除界面,将光标放在要删除项的文本框上即可对该项进行修改。
如果管理员要进行添加操作则选添加项,进入添加窗体可以重新添加用户的各项信息。
如果管理员要进修修改操作则选修改项,进入修改窗体管理员就可以根据需要对用户的各项信息进行修改。
如果管理员要进行查找操作则选查找项,进入查找窗体通过按上一项和下一项即可查找到所需要的用户信息.如果不需要其它操作则可选则退出回到选则进入界面。
八.窗体代码
欢迎窗体:
Private Sub 帮助_Click()
r = MsgBox("点击积分排名进入用户操作界面,点击管理员进入管理员操作界面", 64, "帮助框")
Form1.Show
End Sub
Private Sub 管理员_Click()
Unload Me
form9.Show
mand4.Visible = False
End Sub
Private Sub 退出_Click()
End
End Sub
Private Sub jifenpaiming_Click()
Unload Me
Form2.Visible = True
Form2.menuxiugai.Visible = False
Form2.menutianjia.Visible = False
Form2.menushanchu.Visible = False
mand2.Visible = False
mand4.Visible = True
End Sub
查找窗体:
Private Sub Command1_Click()
Dim h As Integer
Dim n As Integer
Dim F As Integer
Dim Comp1 As String
Dim Comp2 As String
Text1.Text = "手机号码" + " " + "姓名" + " " + "缴费积分" + " " + "消费积分" + " " + "在网时间积分" + " " + "奖励积分" + " " + "转赠积分" + " " + "总积分" + Chr(13) + Chr(10)
F = 0
h = 1
Open "cj.dat" For Random As #1 Len = Len(recordvar)
recordnumer = LOF(1) / Len(recordvar)
For n = 1 To recordnumer
Get #1, n, recordvar
Comp1 = Trim(textfindNum.Text)
temptext.Text = recordvar.sjhm
Comp2 = Trim(temptext.Text)
If StrComp(Comp1, Comp2) = 0 Then
h = n
F = F + 1
Get #1, h, recordvar
With recordvar
Text1.Text = Text1.Text + recordvar.sjhm + " " + recordvar.stname + " " + Trim(recordvar.jfjf) + " " + Trim(recordvar.xfjf) + " " + Trim(recordvar.zwsjjf) + " " + Trim(recordvar.jljf) + " " + Trim(recordvar.zzjf) + " " + Trim(recordvar.average) + Chr(13) + Chr(10)
End With
End If
Next n
Close #1
Label1.Caption = "一共找到" + Str(F) + "条记录"
If F = 0 Then
MsgBox "没有该记录", vbInformation, "提示"
End If
End Sub
Private Sub Command2_Click()
Unload Me
Form2.Show
mand4.Visible = False
mand2.Visible = True
End Sub
Private Sub Command3_Click()
Dim h As Integer
Dim n As Integer
Dim F As Integer
Dim Comp1 As String
Dim Comp2 As String
Text1.Text = "手机号码" + " " + "姓名" + " " + "缴费积分" + " " + "消费积分" + " " + "在网时间积分" + " " + "奖励积分" + " " + "转赠积分" + " " + "总积分" + Chr(13) + Chr(10)
F = 0
h = 1
Open "cj.dat" For Random As #1 Len = Len(recordvar)
recordnumer = LOF(1) / Len(recordvar)
For n = 1 To recordnumer
Get #1, n, recordvar
Comp1 = Trim(textfindname.Text)
temptext.Text = recordvar.stname
Comp2 = Trim(temptext.Text)
If StrComp(Comp1, Comp2) = 0 Then
h = n
F = F + 1
Get #1, h, recordvar
With recordvar
Text1.Text = "手机号码" + " " + "姓名" + " " + "缴费积分" + " " + "消费积分" + " " + "在网时间积分" + " " + "奖励积分" + " " + "转赠积分" + " " + "总积分" + Chr(13) + Chr(10)
End With
Text1.Text = Text1.Text + recordvar.sjhm + " " + recordvar.stname + " " + Trim(recordvar.jfjf) + " " + Trim(recordvar.xfjf) + " " + Trim(recordvar.zwsjjf) + " " + Trim(recordvar.jljf) + " " + Trim(recordvar.zzjf) + " " + Trim(recordvar.average) + Chr(13) + Chr(10)
End If
Next n
Close #1
Label1.Caption = "一共找到" + Str(F) + "条记录" If F = 0 Then
MsgBox "没有该记录", vbInformation, "提示" End If
End Sub
Private Sub Command4_Click()
Unload Me
Form2.Show
Form2.menuxiugai.Visible = False
Form2.menutianjia.Visible = False
Form2.menushanchu.Visible = False
mand2.Visible = False
End Sub
积分显示与编辑窗体:
Private Sub tianjia_Click()
Visible = False
Form5.Visible = True
Unload Form2
End Sub
Private Sub Command1_Click()
Unload Me
Form1.Visible = True
End Sub
Private Sub menuchazhao_Click()
Unload Me
Form10.Show
Form10.temptext.Visible = False
mand2.Visible = True
End Sub
Private Sub menushanchu_Click()
If recordnumer > 0 Then
Visible = False
Form6.Visible = True
Unload Form2
Else
MsgBox "无记录"
End If
End Sub
Private Sub menutianjia_Click()
Visible = False
Form5.Visible = True
Unload Form2
End Sub
Private Sub menuxiugai_Click()
If recordnumer > 0 Then
Visible = False
Form7.Visible = True
Unload Form2
Else
MsgBox "无记录"
End If
End Sub
Private Sub Form_Load()
Open "cj.dat" For Random As #1 Len = Len(recordvar) recordnumer = LOF(1) / Len(recordvar)
file_read1
Close #1
End Sub
Private Sub 退出_Click()
Visible = False
Form1.Show
Form2.修改.Visible = True
Form2.添加.Visible = True
Form2.删除.Visible = True
mand2.Visible = True
mand2.Visible = True
End Sub
Sub file_read1()
Cls
frontsize = 12
Print "手机号码", "姓名", "缴费积分", "消费积分", "在网时间积分", "奖励积分", "转赠积分", "总积分", "积分排名"
For i = 1 To recordnumer
Get #1, i, recordvar
Print recordvar.sjhm, recordvar.stname, recordvar.jfjf, recordvar.xfjf, recordvar.zwsjjf, recordvar.jljf, recordvar.zzjf, recordvar.average, Loc(1)
Next i
End Sub
添加窗体:
Private Sub Form_Load()
End Sub
Private Sub 取消_Click()
Visible = False
Form2.Visible = True
Unload Form5
End Sub
Sub paixu()
For n = 1 To recordnumer - 1
For m = 1 To recordnumer
Get #1, m, recordvar1
Get #1, m + 1, recordvar2
If recordvar2.average > recordvar1.average Then
recordvar.sjhm = recordvar1.sjhm
recordvar.stname = recordvar1.stname
recordvar.jfjf = recordvar1.jfjf
recordvar.xfjf = recordvar1.xfjf
recordvar.zwsjjf = recordvar1.zwsjjf
recordvar.jljf = recordvar1.jljf
recordvar.zzjf = recordvar1.zzjf
recordvar.average = recordvar1.average
Put #1, m, recordvar2
Put #1, m + 1, recordvar
End If
Next m
Next n
End Sub
Private Sub 确定_Click()
If Len(Text1.Text) <> 11 Then
MsgBox "输入的手机号码位数有误请重新输入" Text1.SetFocus
End If
If (Text3.Text < 0) Then
MsgBox "输入有误,请重新输入"
Text3.SetFocus
End If
If (Text4.Text < 0) Then
MsgBox "输入有误,请重新输入"
Text4.SetFocus
End If
If (Text5.Text < 0) Then
MsgBox "输入有误,请重新输入"
Text5.SetFocus
End If
If (Text6.Text < 0) Then
MsgBox "输入有误,请重新输入"
Text6.SetFocus
End If
If (Text7.Text < 0) Then
MsgBox "输入有误,请重新输入"
Text7.SetFocus
End If
Open "cj.dat" For Random As #1 Len = Len(recordvar) recordnumer = LOF(1) / Len(recordvar) recordvar.sjhm = Text1.Text
recordvar.stname = Text2.Text
recordvar.jfjf = Text3.Text
recordvar.xfjf = Text4.Text
recordvar.zwsjjf = Text5.Text
recordvar.jljf = Text6.Text
recordvar.zzjf = Text7.Text
recordvar.average = recordvar.jfjf * 2 + recordvar.xfjf * 2 + recordvar.zwsjjf * 1.5 + recordvar.jljf * 1.5 + recordvar.zzjf
recordnumer = recordnumer + 1
Put #1, recordnumer, recordvar
paixu
Close #1
Visible = False
Form2.Visible = True
Unload Form5
End Sub
修改窗体:
Private Sub Form_Load()
position = 1
Open "cj.dat" For Random As #1 Len = Len(recordvar)
recordnumer = LOF(1) / Len(recordvar)
xianshi
Close #1
End Sub
Private Sub 取消_Click()
Visible = False
Form2.Visible = True
Unload Form7
End Sub
Sub xianshi()
If recordnumer >= 1 Then
Get #1, position, recordvar
Text1.Text = recordvar.sjhm
Text2.Text = recordvar.stname
Text3.Text = recordvar.jfjf
Text4.Text = recordvar.xfjf
Text5.Text = recordvar.zwsjjf
Text6.Text = recordvar.jljf
Text7.Text = recordvar.zzjf
End If
End Sub
Private Sub 确定_Click()
If Len(Text1.Text) <> 11 Then
MsgBox "输入的手机号码有误请重新输入"
End If
If (Text3.Text < 0) Then
MsgBox "输入有误,请重新输入"
Text3.SetFocus
End If
If (Text4.Text < 0) Then
MsgBox "输入有误,请重新输入"
Text4.SetFocus
End If
If (Text5.Text < 0) Then
MsgBox "输入有误,请重新输入"
Text5.SetFocus
End If
If (Text6.Text < 0) Then
MsgBox "输入有误,请重新输入"
Text6.SetFocus
End If
If (Text7.Text < 0) Then
MsgBox "输入有误,请重新输入"
Text7.SetFocus
End If
Open "cj.dat" For Random As #1 Len = Len(recordvar) recordvar.sjhm = Text1.Text
recordvar.stname = Text2.Text
recordvar.jfjf = Text3.Text
recordvar.xfjf = Text4.Text
recordvar.zwsjjf = Text5.Text
recordvar.jljf = Text6.Text
recordvar.zzjf = Text7.Text
recordvar.average = recordvar.jfjf * 2 + recordvar.xfjf * 2 + recordvar.zwsjjf * 2 + recordvar.jljf * 1.5 + recordvar.zzjf
Put #1, position, recordvar
paixu
Close #1
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Visible = False
Form2.Visible = True
Unload Form7
End Sub
Private Sub 上一个_Click()
Open "cj.dat" For Random As #1 Len = Len(recordvar)
If position > 1 Then
position = position - 1
xianshi
ElseIf position = 1 Then
MsgBox "这是第一个记录"
End If
Close #1
End Sub
Private Sub 下一个_Click()
Open "cj.dat" For Random As #1 Len = Len(recordvar)
If position < recordnumer Then
position = position + 1
xianshi
ElseIf position = recordnumer Then
MsgBox "这是最后一个记录"
End If
Close #1
End Sub
Sub paixu()
For n = 1 To recordnumer - 2
For m = 1 To recordnumer - 1
Get #1, m, recordvar1
Get #1, m + 1, recordvar2
If recordvar2.average > recordvar1.average Then recordvar.sjhm = recordvar1.sjhm recordvar.stname = recordvar1.stname recordvar.jfjf = recordvar1.jfjf
recordvar.xfjf = recordvar1.xfjf
recordvar.zwsjjf = recordvar1.zwsjjf recordvar.jljf = recordvar1.jljf
recordvar.zzjf = recordvar1.zzjf
recordvar.average = recordvar1.average
Put #1, m, recordvar2
Put #1, m + 1, recordvar
End If
Next m
Next n
End Sub
管理员登陆窗体:
Option Explicit
Const username As String = "wang"
Const password As String = "214"
Private Sub cmdCancel_Click()
txtUsername.Text = ""
txtPassword.Text = ""
txtUsername.SetFocus
End Sub
Private Sub cmdOK_Click()
Dim i As Integer
Static n As Integer
If txtUsername.Text = username And txtPassword.Text = password Then
Form2.Show
Unload Form1
Unload Me
Else
n = n + 1
If n < 3 Then
i = MsgBox("用户名或密码错误,请重新输入!", vbCritical + vbRetryCancel + vbDefaultButton1, "登录失败")
If i = vbRetry Then
txtUsername.Text = ""
txtPassword.Text = ""
txtUsername.SetFocus
Else
End
End If
Else
MsgBox "三次错误,请退出!", vbOKOnly + vbExclamation, "登录失败"
End
End If
End If
End Sub
Private Sub Command1_Click()
Unload Me
Form1.Show
End Sub
标准窗体:
Type jifen
sjhm As Variant
stname As String
jfjf As Variant
jljf As Variant
xfjf As Variant
zzjf As Variant
zwsjjf As Variant
average As Variant
End Type
Public recordvar As jifen
Public recordvar1 As jifen
Public recordvar2 As jifen
Public recordnumer As Integer
Public position As Intege
删除窗体:
Private Sub Form_Load()
position = 1
Open "cj.dat" For Random As #1 Len = Len(recordvar) recordnumer = LOF(1) / Len(recordvar)
xianshi
Close #1
End Sub
Private Sub 取消_Click()
Visible = False
Form2.Visible = True
Unload Form6
End Sub
Sub xianshi()
If recordnumer >= 1 Then
Get #1, position, recordvar
Text1.Text = recordvar.sjhm
Text2.Text = recordvar.stname
Text3.Text = recordvar.jfjf
Text4.Text = recordvar.xfjf
Text5.Text = recordvar.zwsjjf
Text6.Text = recordvar.jljf
Text7.Text = recordvar.zzjf
End If
End Sub
Private Sub 确定_Click()
If Len(Text1.Text) <> 11 Then
MsgBox "输入的手机号码有误请重新输入"
End If
If (Text3.Text < 0 Or Text3.Text = "") Then
MsgBox "输入有误,请重新输入"
Text3.SetFocus
End If
If (Text4.Text < 0) Then
MsgBox "输入有误,请重新输入"
Text4.SetFocus
End If
If (Text5.Text < 0) Then
MsgBox "输入有误,请重新输入"
Text5.SetFocus
End If
If (Text6.Text < 0) Then
MsgBox "输入有误,请重新输入"
Text6.SetFocus
End If
If (Text7.Text < 0) Then
MsgBox "输入有误,请重新输入"
Text7.SetFocus
End If
Open "cj.dat" For Random As #1 Len = Len(recordvar) repeat:
Get #1, position + 1, recordvar
If Loc(1) > recordnumer Then GoTo finish
Put #1, position, recordvar
position = position + 1
GoTo repeat
finish:
recordnumer = recordnumer - 1
Open "cj1.dat" For Random As #2 Len = Len(recordvar) For i = 1 To recordnumer
Get #1, i, recordvar
Put #2, i, recordvar
Next i
Close #1
Close #2
Kill "cj.dat"
Name "cj1.dat" As "cj.dat"
Visible = False
Form2.Visible = True
Unload Form6
chonglai:
End Sub
Private Sub 上一个_Click()
Open "cj.dat" For Random As #1 Len = Len(recordvar) If position > 1 Then
position = position - 1
xianshi
ElseIf position = 1 Then
MsgBox "这是第一个记录"
End If
Close #1
End Sub
Private Sub 下一个_Click()
Open "cj.dat" For Random As #1 Len = Len(recordvar) If position < recordnumer Then
position = position + 1
xianshi
ElseIf position = recordnumer Then
MsgBox "这是最后一个记录"
End If
Close #1
End Sub
九、结束语
通过一个学期的学习我们对VB这个程序编辑语言有了一定程度的认识在此先要感谢指导我们学习的迟立颖老师。
这个程序是我们四个组员同共努力,加上老师的指导,把所学的知识运用到实际中,在编写的同时我们感觉到了学习了乐趣,在编写的过程中我们也发现了不少的问题也解决了不少问题,在这个过程中我们又学到了些在课堂上学不到的东西。