VB课程设计报告-学生成绩管理系统.doc_第1页
VB课程设计报告-学生成绩管理系统.doc_第2页
VB课程设计报告-学生成绩管理系统.doc_第3页
VB课程设计报告-学生成绩管理系统.doc_第4页
VB课程设计报告-学生成绩管理系统.doc_第5页
已阅读5页,还剩18页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

一、 目的:本次课程设计结合实际应用的要求,使课程设计既覆盖VB的知识点,又接近工程实际需要。目的是通过课程设计的综合训练,培养我们学生实际分析问题、解决问题的能力,以及编程和动手能力,最终目的是通过课程设计这种形式,帮助我们系统的掌握VB这门课程的主要内容,养成良好的变成习惯,更好的完成学习任务。二、 题目及简介:(1) 题目:学生成绩管理系统(2) 简介:学生成绩管理系统是一种集系统开发和实际应用于一体的一种应用性软件,它的开发有益于学生成绩信息条理化管理,大大降低了信息查询的复杂度,彻底实现了电子化管理。三、 设计说明:1、 功能描述用户通过登陆界面进入系统后,在可页面指引下进行一系列的文件创建和保存、学生成绩信息的增加、查询、删除、修改等一系列操作,从而完成对学生成绩的管理。2、 概要设计模块结构图登陆界面主界面显示界面查询界面增加界面删除界面排名界面平均分界面打开保存关闭按学号查询按记录查询修改保存按学号删除按记录删除语文排名数学排名总成绩排名英语排名语文平均分数学平均分英语平均分个人平均分3、 3、详细设计(1)首先创建八个form窗口和一个模块,窗体分别命名为登录、主界面、查询、显示、增加、删除、排名、平均分。 在登录中添加两个Label (Label1、Label2)、两个Text (Text1、Text2)、两个Commandbutton (Command1、Commamd2); 在主界面添加一个下拉式菜单、一个Toolbar、一个imagelist; 在查询中添加七个Label、三个Commamdbutton、两个Optionbutton、一个Frame、六个Text:; 在显示中添加七个Label、四个Commamdbutton、两个Optionbutton、一个Frame、六个Text:;在删除中添加两个Label (Label1、Label2)、两个Text (Text1、Text2)、一个Commandbutton (Command1);在增加中添加七个Label、两个Commamdbutton、两个Optionbutton、一个Frame、六个Text:; 在平均分中添加一个Frame、一个Text、四个commandbutton ;在平均分中添加一个Frame、一个Text、四个commandbutton. (2)增加过程中会对学号是否输入重复、各成绩是否在0100之间进行判断,榆次输出相应的提示信息。四、 源代码模块:Public Type cjbj As String * 6xh As String * 7xm As String * 5xb As String * 1yw As Integersx As Integeryy As Integersum As IntegerEnd TypePublic da As cjPublic lastrec As IntegerPublic current As Integer登录:Private Sub Command1_Click()If Text1.Text = 郭涛涛 And Text2.Text = 123 Then登录.Hide主界面.ShowElsen = n + 1If n = 3 ThenMsgBox 对不起,您无权使用本系统!, 0, 登录失败!Text1.Enabled = FalseText2.Enabled = FalseCommand1.Enabled = FalseElseMsgBox 您还有 & Str(3 - n) & 次机会!, 0, 对不起,用户或密码输入错误Text1.SetFocusEnd IfEnd IfEnd SubPrivate Sub Command2_Click()n = 0Text1.Enabled = TrueText2.Enabled = TrueCommand1.Enabled = TrueText1.Text = Text2.Text = End Sub主界面:Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)Select Case Button.IndexCase 1dakai_ClickCase 2chaxun_ClickCase 3baocun_ClickCase 4关于_ClickEnd SelectEnd SubPrivate Sub xianshi_Click()显示.ShowEnd SubPrivate Sub zhenjia_Click()增加.ShowEnd SubPrivate Sub 关于_Click()MsgBox 谢谢您使用本人自主开发系统,本系统如有错误之处,请见谅!, 0, 欢迎进入学生信息系统End Sub显示:Private Sub Command1_Click(Index As Integer)Static n As IntegerSelect Case IndexCase 0n = 1Case 1If n 1 Then n = n - 1Case 2If n = lastrec ThenMsgBox 这已经是第一条记录!, 0, 提示ElseIf n = 1 ThenMsgBox 这已经是最后一条记录!, 0, 提示End IfEnd IfEnd Function增加:Private Sub Command1_Click()If Text2(3) 100 Or Text2(4) 100 Or Text2(5) 100 ThenMsgBox 分数输入错误,请检查后重新输入!, 0, 警告Exit SubEnd Iflastrec = LOF(1) / Len(da) + 1da.bj = Text2(0).Textda.xh = Text2(1).Textda.xm = Text2(2).Textda.yw = Text2(3).Textda.sx = Text2(4).Textda.yy = Text2(5).TextDim db As cjFor j = 1 To lastrec - 1 Get #1, j, db If StrComp(Trim(db.xh), Trim(da.xh) = 0 Then MsgBox 学号重复,请重新输入!, 0, 警告 Exit SubEnd IfNext jIf a = 0 Then da.xb = 0 Else da.xb = 1Put #1, lastrec, daMsgBox 增加成功!, 0, 提示End SubPrivate Sub Command2_Click()Unload MeEnd SubPrivate Sub Option1_Click(Index As Integer)Select Case IndexCase 0a = 0Case 1a = 1End SelectEnd Sub删除: Private Sub Command1_Click()Open c:学生成绩1 For Random As #2 Len = Len(da)If Text1.Text And Text2.Text ThenMsgBox 输入错误,请重新输入!, 0, 警告ElseIf Text1.Text ThenCall xuehao(Text1)Else: Call jilu(Text2)End IfEnd IfEnd SubPrivate Sub xuehao(p As String)lastrec = LOF(1) / Len(da)For n = 1 To lastrec Get #1, n, da b = Trim(da.xh) If StrComp(p, b) 0 Then Get #1, n, da Put #2, , daElseGet #1, n, daEnd IfNextClose #1Close #2Kill c:学生成绩Name c:学生成绩1 As c:学生成绩Open c:学生成绩 For Random As #1 Len = Len(da)MsgBox 删除成功!, 0, 提示End SubPrivate Sub jilu(p As Integer)Lastrec = LOF(1) / Len(da)For n = 1 To lastrecIf n p Thenk = k + 1Get #1, n, daPut #2, k, daElseGet #1, n, daEnd IfNextClose #1Close #2Kill c:学生成绩Name c:学生成绩1 As c:学生成绩Open c:学生成绩 For Random As #1 Len = Len(da)MsgBox 删除成功!, 0, 提示End Sub查询:Private Sub Command1_Click()k = InputBox(请输入学生学号, 提示)Call xuehao1(k)End SubPrivate Sub xuehao1(p)lastrec = LOF(1) / Len(da)For n = 1 To lastrecGet #1, n, dab = Trim(da.xh)If StrComp(p, b) 0 ThenGet #1, n, daElsew = nCall shuchu1(da)End IfNextEnd SubPrivate Sub jilu1(p)lastrec = LOF(1) / Len(da)For n = 1 To lastrecGet #1, n, daIf n p ThenGet #1, n, daElsew = nCall shuchu1(da)End IfNextEnd SubPrivate Sub shuchu1(p As cj)Text1(0).Text = p.bjText1(1).Text = p.xhText1(2).Text = p.xmText1(3).Text = p.ywText1(4).Text = p.sxText1(5).Text = p.yyIf p.xb = 0 ThenOption1(0).Value = TrueOption1(1).Value = FalseEnd IfIf p.xb = 1 ThenOption1(1).Value = TrueOption1(0).Value = FalseEnd IfEnd SubPrivate Sub Command2_Click()k = InputBox(请输入记录号, 提示)Call jilu1(Val(k)End SubPrivate Sub Command3_Click()da.bj = Trim(Text1(0).Text)da.xh = Trim(Text1(1).Text)da.xm = Trim(Text1(2).Text)da.xb = IIf(Option1(0), 0, 1)da.yw = Val(Text1(3).Text)da.sx = Val(Text1(4).Text)da.yy = Val(Text1(5).Text)Put #1, w, daEnd Sub排名:Private Sub Command1_Click()Frame1.Caption = 班级 学号 姓名 性别 语文 数学 英语 Text1 = Dim p As Stringp = lastrec = LOF(1) / Len(da)ReDim stu(1 To lastrec)For f = 1 To lastrec Get #1, f, stu(f)Next fFor i = 1 To lastrec - 1Max = stu(i).ywFor j = i + 1 To lastrec If Max stu(j).yw Then Max = stu(j).yw da = stu(i) stu(i) = stu(j) stu(j) = da End IfNext jNext iFor k = 1 To lastrec da = stu(k) If Trim(da.xb) = 0 Then da.xb = 男 Else da.xb = 女 End If p = Space(1) & da.bj & Space(1) & da.xh & Space(1) & da.xm & Space(5) & da.xb & Space(5) & da.yw & Space(5) & da.sx & Space(5) & da.yy Text1 = Text1 & p & Chr(13) & Chr(10)Next kEnd SubPrivate Sub Command2_Click()Frame1.Caption = 班级 学号 姓名 性别 语文 数学 英语 Text1 = Dim p As Stringp = lastrec = LOF(1) / Len(da)ReDim stu(1 To lastrec)For f = 1 To lastrec Get #1, f, stu(f)Next fFor i = 1 To lastrec - 1Max = stu(i).sxFor j = i + 1 To lastrec If Max stu(j).sx Then Max = stu(j).sx da = stu(i) stu(i) = stu(j) stu(j) = da End IfNext jNext iFor k = 1 To lastrec da = stu(k) If Trim(da.xb) = 0 Then da.xb = 男 Else da.xb = 女 End If p = Space(1) & da.bj & Space(1) & da.xh & Space(1) & da.xm & Space(5) & da.xb & Space(5) & da.yw & Space(5) & da.sx & Space(5) & da.yy Text1 = Text1 & p & Chr(13) & Chr(10)Next kEnd SubPrivate Sub Command3_Click()Frame1.Caption = 班级 学号 姓名 性别 语文 数学 英语 Text1 = Dim p As Stringp = lastrec = LOF(1) / Len(da)ReDim stu(1 To lastrec)For f = 1 To lastrec Get #1, f, stu(f)Next fFor i = 1 To lastrec - 1Max = stu(i).yyFor j = i + 1 To lastrec If Max stu(j).yy Then Max = stu(j).yy da = stu(i) stu(i) = stu(j) stu(j) = da End IfNext jNext iFor k = 1 To lastrec da = stu(k) If Trim(da.xb) = 0 Then da.xb = 男 Else da.xb = 女 End If p = Space(1) & da.bj & Space(1) & da.xh & Space(1) & da.xm & Space(5) & da.xb & Space(5) & da.yw & Space(5) & da.sx & Space(5) & da.yy Text1 = Text1 & p & Chr(13) & Chr(10)Next kEnd SubPrivate Sub Command4_Click()Frame1.Caption = 班级 学号 姓名 性别 语文 数学 英语 总分Text1 = Dim p As Stringp = lastrec = LOF(1) / Len(da)ReDim stu(1 To lastrec)For f = 1 To lastrec Get #1, f, stu(f) Next fFor i = 1 To lastrecstu(i).sum = Val(stu(i).yw) + Val(stu(i).sx) + Val(stu(i).yy)Next iFor i = 1 To lastrec - 1Max = stu(i).sumFor j = i + 1 To lastrec If Max stu(j).sum Then da = stu(i) stu(i) = stu(j) stu(j) = da End IfNext jNext iFor k = 1 To lastrec da = stu(k) If Trim(da.xb) = 0 Then da.xb = 男 Else da.xb = 女 End If p = Space(1) & da.bj & Space(1) & da.xh & Space(1) & da.xm & Space(5) & da.xb & Space(5) & da.yw & Space(5) & da.sx & Space(5) & da.yy & Space(5) & da.sum Text1 = Text1 & p & Chr(13) & Chr(10)Next kEnd Sub平均分:Private Sub Command1_Click()Dim sum As Singlesum = 0lastrec = LOF(1) / Len(da)For i = 1 To lastrecGet #1, i, dasum = sum + da.ywNext iaverage = sum / lastrecMsgBox 语文总平均分为: & Val(average), 0, 提示End SubPrivate Sub Command2_Click()Dim sum As Singlesum = 0lastrec = LOF(1) / Len(da)For i = 1 To lastrecGet #1, i, dasum = sum + da.sxNext iaverage = sum / lastrecMsgBox 数学总平均分为: & Val(average), 0, 提示End SubPrivate Sub Command3_Click()Dim sum As Singlesum = 0lastrec = LOF(1) / Len(da)For i = 1 To lastrecGet #1, i, dasum = sum + da.yyNext iaverage = sum / lastrecMsgBox 英语总平均分为: & Val(average), 0, 提示End SubPrivate Sub Command4

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论