学生信息管理系统VB.docx

上传人:牧羊曲112 文档编号:3424256 上传时间:2023-03-13 格式:DOCX 页数:28 大小:46.38KB
返回 下载 相关 举报
学生信息管理系统VB.docx_第1页
第1页 / 共28页
学生信息管理系统VB.docx_第2页
第2页 / 共28页
学生信息管理系统VB.docx_第3页
第3页 / 共28页
学生信息管理系统VB.docx_第4页
第4页 / 共28页
学生信息管理系统VB.docx_第5页
第5页 / 共28页
亲,该文档总共28页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《学生信息管理系统VB.docx》由会员分享,可在线阅读,更多相关《学生信息管理系统VB.docx(28页珍藏版)》请在三一办公上搜索。

1、学生信息管理系统VB河北联合大学 软件设计基础 课程设计报告 设计名称: 学生信息管理系统 姓 名: 学 号: 专业班级: 学 院: 设计时间: 设计地点: 学校机房 指导教师评语: 成绩: 指导教师签字: 年 月 日 软件设计基础课程设计报告 第 2 页,共 25 页 目 录 1.课程设计目的 2.课程设计任务与要求 3.课程设计说明书 4.课程设计成果 5.程序调试过程 6.设计问题的不足和改进方案 7.课程设计心得 8.附录 9.参考文献 软件设计基础课程设计报告 第 3 页,共 25 页 1课程设计目的 软件设计基础课程设计是这门课程的实践性教学环节之一,本次设计结合实际应用的要求,使

2、课程设计既覆盖VB的知识点,又接近工程实际需要。目的是通过课程设计的综合训练,培养学生实际分析问题、解决问题的能力,以及编程和动手能力,最终目标是通过课程设计这种形式,帮助学生系统掌握VB这门课程的主要内容,养成良好的编程习惯,更好的完成教学任务。 2课程设计任务与要求: 要求: 本次课程设计利用软件设计基础课程中所学到的编程知识和编程技巧,完成具有一定难度和工作量的程序设计题目,帮助学生掌握编程、调试的基本技能,独立完成所布置的任务。 要求: 1、对系统进行功能需求分析 2、设计合理的数据结构和系统框架 3、界面设计美观、清楚、合理 4、编程简练,程序功能齐全,能正确运行 5、具有一定的创新

3、性 6、说明书、流程图要清楚 7、课题完成后必须按要求提交课程设计报告 任务: 一.目的: 培养学生综合利用VB语言进行程序设计的能力,主要是培养学生利用系统提供的基本控件、动态数组、文件以及程序结构进行创新性设计。 二.基本要求: 1.要求用随机文件、MSFlexGrid控件、DTPicker控件和动态数组来完成程序的设计。 2. 完成的程序界面要美观,能够完成游戏的整个过程。 三.创新要求: 在基本要求达到后,进行创新设计,如用户权限。 软件设计基础课程设计报告 第 4 页,共 25 页 3课程设计说明书 功能描述: 1.学生信息保存在随机访问文件data.dat中,运行程序时,自动列出数

4、据文件data.dat中保存的所有学生信息。 2. 使用鼠标单击表格的某一单元格,该单元格突出显示,所在行为当前行。单击工具栏上的“插入”按钮,在当前位置上插入一个新空行,单击“追加”按钮在表格最后添加一个空行。使用“删除”按钮可以删除当前行。 3.无论是空格还是已有数据的格,都可以对其中的数据进行直接编辑。对对于学号、姓名和高考分数三列数据使用文本框进行编辑;对于出生日期使用DTPicker控件进行编辑;对于性别、民族、院系、专业和省份等五列数据,使用组合框控件编辑。对数据进行编辑之后,单击“保存”按钮将编辑后的结果保存到data.dat文件中。 4.选择“查询”按扭,弹出“查询”对话框。在

5、“查询”对话框中设置查询条件,“学号”和“姓名”可以输入完整的学号和姓名,也可以输入部分学号和姓名;“出生日期”和“高考分数”中可输入分数和日期范围,其中日期的输入要求使用DTPicker控件。 5.如果用户对数据进行了修改,关闭程序时弹出“退出”对话框。 概要设计 主要写模块说明,模块结构图,系统流程图 模块结构图: 根据功能分析,建立系统的体系结构,即将整个系统分解成若干子模块,用框图表示各功能模块之间的接口关系。 输入登陆信息 验证信息 错正误确 进入系统 提示登录警告 执行操作 简易文件系统功能框图 软件设计基础课程设计报告 第 5 页,共 25 页 详细设计 总体流程图: 各功能模块

6、流程图: 根据以上条件显示结果 条件1 条件2 条件3 条件4 判断 选择查询信息 保存 显示查询结果 输入添加信息 输入查询条件 验证登陆信息 运行登陆界面 错误追加系统 正确提示登陆警告 查询统统 软件设计基础课程设计报告 第 6 页,共 25 页 代码实现 详细说明各功能模块的实现过程,所用到的算法、技巧等。如:本系统总共10个窗体:form1form10详细如下: form1、首页 作用:“进入应用程序”。 所用控件:5个标签,4个时钟。 设计思路:用时钟控制label1、2,3,4的运动。单击label1,2,5和命令选择器可进入后面窗体,label3.无链接窗体,无label4 。

7、 详细内容:属性较特殊的需要说明。代码如下: 本系统总共有窗体Form1、Form2和Main三个;一个模块。 模块窗体: 作用: 所用控件: 设计思路: 过程代码: Public Declare Function SkinH_Attach Lib SkinH_VB6.dll As Long Public Declare Function SkinH_AttachEx Lib SkinH_VB6.dll (ByVal lpSkinFile As String, ByVal lpPasswd As String) As Long Public Declare Function SkinH_Att

8、achExt Lib SkinH_VB6.dll (ByVal lpSkinFile As String, ByVal lpPasswd As String, ByVal nHue As Integer, ByVal nSat As Integer, ByVal nBri As Integer) As Long Public Declare Function SkinH_AttachRes Lib SkinH_VB6.dll (lpRes As Any, ByVal nSize As Long, ByVal lpPasswd As String, ByVal nHue As Integer,

9、ByVal nSat As Integer, ByVal nBri As Integer) As Long Public Declare Function SkinH_AdjustHSV Lib SkinH_VB6.dll (ByVal nHue As Integer, ByVal nSat As Integer, ByVal nBri As Integer) As Long Public Declare Function SkinH_Detach Lib SkinH_VB6.dll As Long Public Declare Function SkinH_DetachEx Lib Skin

10、H_VB6.dll (ByVal hWnd As Long) As Long Public Declare Function SkinH_SetAero Lib SkinH_VB6.dll (ByVal hWnd As Long) As Long Public Declare Function SkinH_SetWindowAlpha Lib SkinH_VB6.dll (ByVal hWnd As Long, ByVal nAlpha As Integer) As Long Public Declare Function SkinH_SetMenuAlpha Lib SkinH_VB6.dl

11、l (ByVal nAlpha As Integer) As Long Public Declare Function SkinH_GetColor Lib SkinH_VB6.dll (ByVal hWnd As Long, ByVal nPosX As Integer, ByVal nPosY As Integer) As Long Public Declare Function SkinH_Map Lib SkinH_VB6.dll (ByVal hWnd As Long, ByVal nType As Integer) As Long Public Declare Function S

12、kinH_LockUpdate Lib SkinH_VB6.dll (ByVal hWnd As Long, ByVal nLocked As Integer) As Long Public Declare Function SkinH_SetBackColor Lib SkinH_VB6.dll (ByVal hWnd As Long, ByVal nRed As Integer, ByVal nGreen As Integer, ByVal nBlue As Integer) As Long Public Declare Function SkinH_SetForeColor Lib Sk

13、inH_VB6.dll (ByVal hWnd As Long, ByVal nRed As Integer, ByVal nGreen As Integer, ByVal nBlue As Integer) As Long 软件设计基础课程设计报告 第 7 页,共 25 页 Public Declare Function SkinH_SetWindowMovable Lib SkinH_VB6.dll (ByVal hWnd As Long, ByVal bMove As Integer) As Long Public Declare Function SkinH_AdjustAero Li

14、b SkinH_VB6.dll (ByVal nAlpha As Integer, ByVal nShwDark As Integer, ByVal nShwSharp As Integer, ByVal nShwSize As Integer, ByVal nX As Integer, ByVal nY As Integer, ByVal nRed As Integer, ByVal nGreen As Integer, ByVal nBlue As Integer) As Long Public Declare Function SkinH_NineBlt Lib SkinH_VB6.dl

15、l (ByVal hDtDC As Long, ByVal left As Integer, ByVal top As Integer, ByVal right As Integer, ByVal bottom As Integer, ByVal nMRect As Integer) As Long Public Declare Function SkinH_SetTitleMenuBar Lib SkinH_VB6.dll (ByVal hWnd As Long, ByVal bEnable As Integer, ByVal nMenuY As Integer, ByVal nTopOff

16、s As Integer, ByVal nRightOffs As Integer) As Long Public Declare Function SkinH_SetFont Lib SkinH_VB6.dll (ByVal hWnd As Long, ByVal hFont As Long) As Long Public Declare Function SkinH_SetFontEx Lib SkinH_VB6.dll (ByVal hWnd As Long, ByVal szFace As String, ByVal nHeight As Integer, ByVal nWidth A

17、s Integer, ByVal nWeight As Integer, ByVal nItalic As Integer, ByVal nUnderline As Integer, ByVal nStrikeOut As Integer) As Long Public Declare Function SkinH_VerifySign Lib SkinH_VB6.dll As Long Main窗体: 作用: 设置登陆界面,安全登陆。 所用控件:1个按钮,4个Label,1个Combo。 设计思路:采用if条件结构。 过程代码: Private Sub Image2_Click Form1.

18、Show End Sub Private Sub Command1_Click If Combo1.Text = 学生 Then If user.Text = student And psw.Text = 123456 Then Me.Hide: Form1.Show Else MsgBox 账号不存在! End If Else If Combo1.Text = 教师 Then If user.Text = teacher And psw.Text = admin Then Me.Hide: Form1.Show Else MsgBox 账号不存在! End If End If End If

19、End Sub Private Sub Form_Load 软件设计基础课程设计报告 第 8 页,共 25 页 SkinH_Attach SkinH_AttachEx App.Path & /skin.she, Call SkinH_SetAero(1) = Combo1.AddItem 教师 Combo1.AddItem 学生 Combo1.ListIndex = 1 End Sub Private Sub Label6_Click MsgBox 教师账号:teacher 密码:admin & vbCrLf & 学生账号:student密码:123456, vbInformation, 提示

20、 End Sub Form1窗体: 作用:实现学生信息管理。 控件:6个PictureBox,2个按钮,1个CommonDialog。 过程代码: Option Explicit Dim mz(31) As String Dim yx(31) As String Dim zy(30) As String Dim pr(33) As String Dim a, b, c, d As Integer Dim arr(10, 8) As String Private OldText As String Private ColSelect As Boolean Private SaveCellBkCo

21、lor As Long Private Sub Command1_Click End End Sub Private Sub Command2_Click MSFlexGrid背景图替换 MsgBox 本操作可对选中的MSFlexGrid框体进行背景图片替换., vbInformation, 提示 Dim pic As String CommonDialog1.InitDir = App.Path CommonDialog1.Filter = 图片(*.jpg)|*.jpg|*.bmp|*.gif|*.* CommonDialog1.FilterIndex = 1 CommonDialog1.

22、ShowOpen pic = CommonDialog1.FileName Set MSFlexGrid1.CellPicture = LoadPicture(pic) End Sub Private Sub Form_Load Dim i As Integer Dim s As String Dim str As String i = a = b = c = d = 0 软件设计基础课程设计报告 第 9 页,共 25 页 =设置Picturebox属性 For i = 0 To 5 Picture1(i).BorderStyle = 0 Picture1(i).Tag = 0 Picture

23、1(i).Appearance = 0 Next SkinH_Attach SkinH_AttachEx App.Path & /skin.she, Call SkinH_SetAero(1) = With MSFlexGrid1 .Cols = 10 .Rows = 11 ReDim ColSelect(1 To .Cols - 1) SaveCellBkColor = .CellBackColor Call InitGrid .AllowBigSelection = True .FillStyle = flexFillRepeat End With =加载数据到各数组= Open App.

24、Path & 民族.txt For Input As #1 Do While Not EOF(1) Line Input #1, s str = Split(Trim(s), ,) mz(a) = str(1) a = a + 1 Loop Close #1 = Open App.Path & 院系.txt For Input As #2 Do While Not EOF(2) Line Input #2, s str = Split(Trim(s), ,) yx(b) = str(1) b = b + 1 Loop Close #2 = Open App.Path & 专业.txt For

25、Input As #3 Do While Not EOF(3) Line Input #3, s str = Split(Trim(s), ,) zy(c) = str(1) c = c + 1 Loop Close #3 软件设计基础课程设计报告 第 10 页,共 25 页 = Open App.Path & 省份.txt For Input As #4 Do While Not EOF(4) Line Input #4, s str = Split(Trim(s), ,) pr(d) = str(1) d = d + 1 Loop Close #4 =加载数据完毕= Call cf End

26、 Sub Sub readfile Dim i As Integer Dim k As Integer k = 0 =加载DATA.DAT数据库= Dim readstr, str As String Open App.Path & data.dat For Input As #5 Do While Not EOF(5) Line Input #5, readstr If Trim(readstr) Then str = Split(Trim(readstr), ) For i = 0 To 8 arr(k, i) = str(i) 输入值到数组 Next k = k + 1 End If L

27、oop Close #5 =加载完毕= End Sub Sub cf Dim s As Integer Dim i As Integer Dim h, l, m, n As Integer For i = 0 To 9 With MSFlexGrid1 .Row = i + 1 .Col = 1: .Text = arr(i, 0) .Col = 2: .Text = arr(i, 1) .Col = 3: .Text = arr(i, 2) If Val(arr(i, 3) = 0 Then .Col = 4: .Text = 男 Else .Col = 4: .Text = 女 软件设计基

28、础课程设计报告 第 11 页,共 25 页 End If s = Val(arr(i, 4) .Col = 5: .Text = mz(s) s = Val(arr(i, 5) .Col = 6: .Text = yx(s) s = Val(arr(i, 6) .Col = 7: .Text = zy(s) s = Val(arr(i, 7) .Col = 8: .Text = pr(s) .Col = 9: .Text = arr(i, 8) End With Next End Sub Private Sub InitGrid Dim i As Long With MSFlexGrid1 .

29、Row = 0 .Col = 0: .Text = 序号 .Col = 1: .Text = 学号 .Col = 2: .Text = 姓名 .Col = 3: .Text = 出生日期 .Col = 4: .Text = 性别 .Col = 5: .Text = 民族 .Col = 6: .Text = 院系 .Col = 7: .Text = 专业 .Col = 8: .Text = 省份 .Col = 9: .Text = 高考分数 End With With MSFlexGrid1 .Col = 0 For i = 1 To .Rows - 1 .Row = i: .Text = i

30、Next End With Dim width5 As Long With MSFlexGrid1 .ColWidth(0) = 500 .ColWidth(1) = 1100 .ColWidth(2) = 800 .ColWidth(3) = 1300 .ColWidth(4) = 450 .ColWidth(5) = 500 .ColWidth(6) = 1400 .ColWidth(7) = 1200 .ColWidth(8) = 500 软件设计基础课程设计报告 第 12 页,共 25 页 .ColWidth(9) = 600 End With Call readfile End Su

31、b Private Sub MSFlexGrid1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim inMostLeft As Boolean Dim inMostTop As Boolean Call ProcMultiColSel(Shift) With MSFlexGrid1 If Button = vbKeyRButton Then 按mouse 右键且位於最上列/最左行则是更动title If .MouseCol = 0 Or .MouseRow = 0 Then Call toEd

32、itGrid(.MouseCol, .MouseRow) End If Else If Button = vbKeyLButton Then If .ColSel = .Col And .RowSel = .Row Then 表示没有多个栏位的选取,这时才真正是可以输入 Call toEditGrid(.Col, .Row) End If End If End If End With End Sub Private Sub MSFlexGrid1_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn And

33、 Not Text1.Visible Then With MSFlexGrid1 Call toEditGrid(.Col, .Row) End With End If End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call change End Sub Private Sub Picture1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single

34、, Y As Single) Select Case Index Case 0 If Picture1(0).Tag = 0 Then Picture1(0).Tag = 1 Picture1(0).BorderStyle = 1 End If Case 1 If Picture1(1).Tag = 0 Then Picture1(1).Tag = 1 软件设计基础课程设计报告 第 13 页,共 25 页 Picture1(1).BorderStyle = 1 End If Case 2 If Picture1(2).Tag = 0 Then Picture1(2).Tag = 1 Pictu

35、re1(2).BorderStyle = 1 End If Case 3 If Picture1(3).Tag = 0 Then Picture1(3).Tag = 1 Picture1(3).BorderStyle = 1 End If Case 4 If Picture1(4).Tag = 0 Then Picture1(4).Tag = 1 Picture1(4).BorderStyle = 1 End If Case 5 If Picture1(5).Tag = 0 Then Picture1(5).Tag = 1 Picture1(5).BorderStyle = 1 End If

36、End Select End Sub Private Sub Picture1_Click(Index As Integer) Dim s As Integer Dim i, j As Integer Select Case Index Case 0 Call ck Case 1 MSFlexGrid1.Rows = MSFlexGrid1.Rows + 1 For i = MSFlexGrid1.Rows - 1 To MSFlexGrid1.Row + 2 Step -1 For j = 0 To MSFlexGrid1.Cols - 1 MSFlexGrid1.TextMatrix(i,

37、 j) = MSFlexGrid1.TextMatrix(i - 1, j) Next Next MSFlexGrid1.Row = MSFlexGrid1.Row + 1 For i = MSFlexGrid1.Row To MSFlexGrid1.Row For j = 0 To MSFlexGrid1.Cols - 1 MSFlexGrid1.TextMatrix(i, j) = Next Next Case 2 s = MSFlexGrid1.RowSel + 1 MSFlexGrid1.AddItem s 软件设计基础课程设计报告 第 14 页,共 25 页 Case 3 MSFle

38、xGrid1.RemoveItem MSFlexGrid1.Row Case 4 Form2.Show Case 5 MsgBox 欢迎使用学生管理系统, vbInformation, 系统 End Select End Sub Private Sub change On Error Resume Next Dim i As Integer For i = 0 To 5 If Picture1(i).Tag = 1 Then Picture1(i).Tag = 0 Picture1(i).BorderStyle = 0 End If Next End Sub TextBox上的输入反映到MsF

39、lexGrid上 Private Sub Text1_Change MSFlexGrid1.Text = Text1.Text End Sub 按下Down/Up 时结束TextBox的Keyin Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyUp Then Text1.Visible = False MSFlexGrid1.SetFocus SendKeys up Else If KeyCode = vbKeyDown Then Text1.Visible = False M

40、SFlexGrid1.SetFocus SendKeys down End If End If Form1.Tag = 1 End Sub Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = vbKeyReturn Then KeyAscii = 0 Text1.Visible = False MSFlexGrid1.SetFocus End If If KeyAscii = vbKeyEscape Then KeyAscii = 0 MSFlexGrid1.Text = OldText 软件设计基础课程设计报告 第 15

41、 页,共 25 页 Text1.Visible = False MSFlexGrid1.SetFocus End If End Sub Private Sub Text1_LostFocus Text1.Visible = False End Sub 设定TextBox於MSFlexGrid1的Current Cell上 Private Sub toEditGrid(ByVal c As Integer, ByVal r As Integer) With MSFlexGrid1 .Col = c: .Row = r Text1.left = .left + .ColPos(c) Text1.t

42、op = .top + .RowPos(r) If .Appearance = flex3D Then Text1.left = Text1.left + 2 * Screen.TwipsPerPixelX Text1.top = Text1.top + 2 * Screen.TwipsPerPixelY End If Text1.Width = .ColWidth(c) Text1.Height = .RowHeight(r) Text1.Text = .Text OldText = .Text End With Text1.Visible = True Text1.SelStart = Len(Text1.Text) Text1.Se

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号