VB课程设-设计模板.doc_第1页
VB课程设-设计模板.doc_第2页
VB课程设-设计模板.doc_第3页
VB课程设-设计模板.doc_第4页
全文预览已结束

下载本文档

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

文档简介

此文档收集于网络,如有侵权,请联系网站删除学生成绩的文件管理设计报告学院 土木工程学院 班级 测绘C111 学号 117534 姓名 白玉 成绩 一、设计思路1.要达到的目的能够按照要求画出界面。要求实现顺序、随机和二进制三种访问文件的方式。使用Option控件进行项目的选择。使用TEXT文本框控件显示读入文件的内容2.关键问题的解决利用Open App.Path & score.txt For Input As #fileno语句将score.txt文件打开。利用Fornext循环和Doloop循环读取数据和处理数据。利用IfElseIfEndIf循环读取数据。利用IfElseIfEndIf循环判断输入分数正确性(扩充部分)。利用Doloop循环查找成绩(扩充部分)。二、模块之间的调用关系,或程序流程图三、部分程序关键源代码及注释Private Sub Command1_Click() Dim english, math, com As Integer Dim name As String name = Text1.Text english = Val(Text2.Text) math = Val(Text3.Text) com = Val(Text4.Text) If english 100 Or english 100 Or math 100 Or com 0 Then 判断输入分数正确性 Dim msg, style, title, response msg = 输入分数不正确。 style = vbOKOnly title = 提示信息 response = MsgBox(msg, style, title) Else If Option1.Value Then Open App.Path & score1.txt For Append As #1 保存成绩操作 Print #1, name, Write #1, english, math, com Close #1 ElseIf Option2.Value Then Dim stu1 As ID, stu As ID Dim i As Integer Open App.Path & score2.txt For Random As #30 Len = Len(stu1) Do While Not EOF(30) i = i + 1 Get #30, i, stu Loop Close #30 Open App.Path & score2.txt For Random As #3 Len = Len(stu1) = name stu1.english = english stu1.math = math = com Put #3, i + 1, stu1 Close #3 ElseIf Option3.Value Then Open App.Path & score3.txt For Binary As #50 Do While Not EOF(50) i = i + 1 Get #50, , stu Loop Close #50 Open App.Path & score3.txt For Binary As #5 = name stu1.english = english stu1.math = math = com Put #5, 1 + 12 * i, stu1 Close #5 End If End IfEnd SubPrivate Sub Command2_Click()If Option1.Value Then Dim str1 As String Text5.Text = Open App.Path & score1.txt For Input As #2 顺序文件读取操作 Do While Not EOF(2) Line Input #2, str1 Text5 = Text5 & str1 & vbNewLine Loop Close #2ElseIf Option2.Value Then Dim stu As ID Text5.Text = Open App.Path & score2.txt For Random As #4 Len = Len(stu) 随机文件读取操作 Do While Not EOF(4) i1 = i1 + 1 Get #4, i1, stu Text5 = Text5 & & , & stu.english & , & stu.math & , & & vbNewLine Loop Close #4ElseIf Option3.Value Then Text5.Text = Open App.Path & score3.txt For Binary As #6 二进制读取文件读操作 Do While Not EOF(6) Get #6, , stu Text5 = Text5 & & , & stu.english & , & stu.math & , & & vbNewLine Loop Close #6End IfEnd SubPrivate Sub Command3_Click()Dim search As String * 3, index As IDsearch = InputBox(请输入查找的姓名(在随机下的查找)) 对符合条件的记录,在text中显示出来Open App.Path & score2.txt For Random As #7 Len = Len(index)Do While Not EOF(7) i2 = i2 + 1 Get #7, i2, index Text5 = Text5 & & & index.english & & index.math & & If = search Then Text5 = Text5 = & & index.english & & index.math & & End IfLoop If Text5 = Then Text5 = 没有找到 + search + 的成绩 End IfClose #7End SubPrivate Sub form_load() Text1.Text = 清空text的内容 Text2.Text = Text3.Text = Text4.Text = Text5.Text = End Sub四、设计方案的完善及目前存在的问题1设计方案要完善的地方导入成绩不能分行显示。2. 目前存在的问题查找成绩有一些问题。五、本次设计的收获及心得体会1. 认识到一学期VB学习内容的重要性与实用性2. 可以用所学知识编一些简单的程序,同时体会到学好一门课程掌握一种技能都不简单,都要用心去做,并且必须大胆尝试3. 学会要勤于查找资料与虚心向他人请教4. 在工作学习过程中大家应该积极讨论,互相帮助5. 感谢老师的指导与支持通过这次课程设计,认识到了自己许多的缺点与不足,今后应该端正学习态度,认真钻研,一

温馨提示

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

评论

0/150

提交评论