⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 课程设计.txt

📁 用VB实现的小型信息系统课程设计,希望对大家有帮助
💻 TXT
字号:
         小型信息系统课程设计报告书
设计题目:旅行社管理系统
班级:01103406
学号:19
姓名:张忭
完成日期:2005.1.9



一、需求分析
1、系统描述:针对旅行社的管理系统,能对定单的各个内容进行保存,查询,修改,以及删除等功能。同时对个人信息也能实现以上功能。
2、数据流图
3、数据字典
4、对基本处理的说明

二、系统设计
1、总体设计:
   
2、信息代码设计:
    自定义数据类型:
Option Explicit
Public Type shes
    start As String * 8
    end As String * 8
    stime As Date
    etime As Date
    other As String * 100
    End Type

对表格控件的修改:
Private Sub MSFlexGrid1_EnterCell()
    Text1.Top = MSFlexGrid1.Top + MSFlexGrid1.CellTop
    Text1.Left = MSFlexGrid1.Left + MSFlexGrid1.CellLeft
    Text1.Width = MSFlexGrid1.CellWidth
    Text1.Height = MSFlexGrid1.CellHeight
    Text1.Text = MSFlexGrid1.Text
End Sub
Private Sub MSFlexGrid1_LeaveCell()
 MSFlexGrid1.Text = Text1.Text
End Sub
这里使用了一个文本框,将其重合的放置在表格的当前单元格上,每次改变单元格时文本框也一起移动。在LeaveCell事件中把用户编辑的内容给旧的单元格,在EnterCell事件中将新的单元格的内容赋给文本框供用户编辑(除了固定行和固定列上的单元格)。

3、数据库设计:运用VB6.0自带可视化数据管理可不用ACCESS也能进行数据库的创建和编辑。本程序建立了一个server.mdb文件,内有Stu1表,其中的7个字段列表Id,Name,age,phone,suoshu,shenfen,sex分别代表了成员信息中的编号,姓名,年龄,电话,所属社团号,身份证号,性别。在通过VB绑定到DATA控件,即可实现数据库的所有功能。
    

4、用户界面设计:
    运用VB的工具栏将所需要的各个控件在窗口上布置好,并通过控件的属性设置将其设计成满意的状态。

三、软件支撑环境及开发工具:
    软件支撑环境:Microsoft Windows Xp 操作系统
    开发工具:Microsoft Visual Basic 6.0
(注:需要在VB内部加入Microsoft Windows Common Controls-2 6.0部件以可以使用DTPicker控件,主要目的是美化日期的输入效果)

四、系统实施:
主要模块的算法设计及源程序清单:
1、Module1模块:
Option Explicit
Public Type shes
    start As String * 8
    end As String * 8
    stime As Date
    etime As Date
    other As String * 100
    End Type

2、窗体frmLogin:
Private Sub cmdCancel_Click()
   Unload Me
End Sub

Private Sub cmdOK_Click()
 frmanother.Show
End Sub

3、窗体frmMain:
Private Sub Command1_Click()
Unload Me
End Sub

Private Sub Command2_Click()
  Dim i As Integer
  i = MsgBox("确实要删除此记录吗!!!", vbYesNo + vbInformation, "删除...")
  If i = 6 Then
    Dim StrId As String
    StrId = Me.Text1.Text
    Me.Data1.Recordset.FindFirst "Id =" & "'" & StrId & "'"
    Me.Data1.Recordset.Edit
   Me.Data1.Recordset.Delete
    MsgBox "记录已经删除!!!", vbOKOnly + vbInformation, "提示"
    frmMain.Data1.Refresh
    
  Else
    Exit Sub
  End If
End Sub

Private Sub Command3_Click()
  frmAdd.Show
End Sub

Private Sub Command4_Click()
  frmEdit.Show
End Sub
Private Sub Command7_Click()
  Data1.Recordset.MoveNext
 
    If Data1.Recordset.EOF = True Then
      MsgBox "已经是最后一条记录!", vbOKOnly, "提示框"
      Data1.Recordset.MoveLast
    Exit Sub
  End If
End Sub

Private Sub Command8_Click()
  Data1.Recordset.MovePrevious
  
  If Data1.Recordset.BOF = True Then
    MsgBox "已经是第一条记录!", vbOKOnly, "提示框"
    Data1.Recordset.MoveFirst
    Exit Sub
  End If
End Sub

Private Sub Form_Load()
  Me.Data1.DatabaseName = VB.App.Path & "\Database\Server.mdb"
End Sub


4、窗体frmanother:
Option Explicit
Private she As shes
Private IntCurrentRecord As Integer
Private IntLastRecord As Integer
Private IntFileNum As Integer
Private Sub Command1_Click()
   she.start = Text1.Text
   she.end = Text2.Text
   she.stime = DTPicker1.Value
   she.etime = DTPicker2.Value
   she.other = Text3.Text
   she.road = Text4.Text
   IntLastRecord = IntLastRecord + 1
   Put #IntFileNum, IntLastRecord, she
   HScroll1.Max = IntLastRecord
   HScroll1.Value = HScroll1.Max
   Label1.Caption = "社团号:" & IntCurrentRecord
  
End Sub

Private Sub Command2_Click()
     she.start = Text1.Text
     she.end = Text2.Text
     she.stime = DTPicker1.Value
     she.etime = DTPicker2.Value
     she.other = Text3.Text
     she.road = Text4.Text
     Put #IntFileNum, IntCurrentRecord, she
     MsgBox "保存成功"
     
End Sub


Private Sub Command3_Click()
    Text1.Text = "*" & Text1.Text
    she.start = Text1.Text
    Put #IntFileNum, IntCurrentRecord, she
End Sub
Private Sub Command4_Click()
frmMain.Show
End Sub

Private Sub Command5_Click()
Dim intCounter1, intCounter2 As Integer
    Dim inttempFileNum As Integer
    inttempFileNum = FreeFile()
    Open App.Path & "\temp.txt" For Random As #inttempFileNum Len = Len(she)
    intCounter2 = 1
    For intCounter1 = 1 To IntLastRecord
       Get #IntFileNum, intCounter1, she
    
    If Left$(she.start, 1) <> "*" Then
    Put inttempFileNum, intCounter2, she
    intCounter2 = intCounter2 + 1
    End If
    Next intCounter1
    Close #inttempFileNum
    Close #IntFileNum
    Kill (App.Path & "\she num.txt")
    Name App.Path & "\temp.txt" As App.Path & "\she num.txt"
    MsgBox "已删除"
    Unload Me
    
End Sub

Private Sub Command6_Click()
Unload Me
End Sub

Private Sub Form_Load()
IntFileNum = FreeFile()
Open App.Path & "\she num.txt" For Random As #IntFileNum Len = Len(she)
IntLastRecord = LOF(1) / Len(she)
Label1.Caption = "社团号:" & 1
IntCurrentRecord = 1
If LOF(1) <> 0 Then
Get #IntFileNum, IntCurrentRecord, she
Text1.Text = she.start
Text2.Text = she.end
DTPicker1.Value = she.stime
DTPicker2.Value = she.etime
Text3.Text = she.other
Text4.Text = she.road
End If
HScroll1.Min = 1
HScroll1.Max = IntLastRecord
HScroll1.LargeChange = 5
HScroll1.SmallChange = 1
HScroll1.Value = 1
End Sub

Private Sub HScroll1_Change()
IntCurrentRecord = HScroll1.Value
Get #IntFileNum, IntCurrentRecord, she
Text1.Text = she.start
Text2.Text = she.end
DTPicker1.Value = she.stime
DTPicker2.Value = she.etime
Text3.Text = she.other
Text4.Text = she.road
Label1.Caption = "社团号:" & IntCurrentRecord
End Sub

5、窗体frmEdit:
Private Sub Command1_Click()
  frmMain.Data1.Recordset.Edit
  Me.Text1.Enabled = True
  Me.Text2.Enabled = True
  Me.Text3.Enabled = True
  Me.Text4.Enabled = True
  Me.Text5.Enabled = True
  Me.Text6.Enabled = True
  Me.Text7.Enabled = True
  Me.Command1.Enabled = False
End Sub
Private Sub Command2_Click()
  frmMain.Data1.Recordset.Edit
  frmMain.Data1.Recordset.Fields("Id").Value = Me.Text1.Text
  frmMain.Data1.Recordset.Fields("Name").Value = Me.Text2.Text
  frmMain.Data1.Recordset.Fields("age").Value = Me.Text3.Text
  frmMain.Data1.Recordset.Fields("Sex").Value = Me.Text4.Text
  frmMain.Data1.Recordset.Fields("Phone").Value = Me.Text5.Text
  frmMain.Data1.Recordset.Fields("suoshu").Value = Me.Text6.Text
  frmMain.Data1.Recordset.Fields("shenfen").Value = Me.Text7.Text
  frmMain.Data1.Recordset.Update
  Me.Command2.Enabled = False
  MsgBox "修改记录成功!!!", vbOKOnly + vbInformation, "提示..."
  frmMain.Data1.Refresh
  Unload Me
End Sub
Private Sub Command3_Click()
  Unload Me
End Sub
Private Sub Form_Load()
  Me.Text1.Text = frmMain.Data1.Recordset.Fields("Id").Value
  Me.Text2.Text = frmMain.Data1.Recordset.Fields("Name").Value
  Me.Text3.Text = frmMain.Data1.Recordset.Fields("age").Value
  Me.Text4.Text = frmMain.Data1.Recordset.Fields("Sex").Value
  Me.Text5.Text = frmMain.Data1.Recordset.Fields("Phone").Value
  Me.Text6.Text = frmMain.Data1.Recordset.Fields("suoshu").Value
  Me.Text7.Text = frmMain.Data1.Recordset.Fields("shenfen").Value
End Sub


4、给出软件的测试方法和测试结果:
     进入界面后,点击“进入”,进入“社团信息”窗口,这里可以自由编辑定单的各个内容;“新建”——可创建一个新的表单;“保存”——保存当前表单;“删除标记”——在待删除表单号之前打上“*”的记号;“确定删除”——完全删除表单号前有“*”号的所有表单;拖动屏幕最上方的HScroll可在不同表单之间自由转换;点击“成员信息“进入成员信息管理。在这里可以对成员进行自由编辑,具体形式和上面类似,不再复述。具体测试结果请见电子文档。

    


五、研制报告:
1、主要研制过程:
    最初的想法使用MSFlexGrid来对大量的文件进行输入。MSFlexGrid具有很强的数据组织和显示能力,但本身无数据编辑的功能,不过可以使用了文本框来协助数据编辑。当使用鼠标单击一个数据单元格时(EnterCell事件发生),显示响应的控件进入编辑状态;当切换到其他单元格时(LeaveCell事件发生),将修改后的数据写入单元格中。但是在研制的过程中发现:以上方法只能实现对MSFlexGrid单元格的编辑,无法修改后保存信息,如果想实现以上功能就必须自定义数据类型并声明此类型的动态数组在保存个人的信息。表格的每一行对应一个数组元素,每一列对应自定义类型的一个数据成员。再运用.dat文件来保存信息,其打开与修改是于动态数组直接联系的,表格控件只用来显示信息。这种方法十分繁琐,鉴于时间关系,只能采用的较简单的data控件绑定数据库的方法来实现。
    
2、自我评价:
    不得不指出,目前采用的方法并不完美,虽然可是实现基本功能,但系统输入的效果和界面远不如前者来得方便和吸引人,今后我会更加深入的了解MSFlexGrid控件的特点,是自己的程序更加具有亲和力。
    另外,用户界面不够吸引人也是不足之处。

3、收获与体会:
    通过这次课程设计,我用规定的时间相对独立的完成了一个实用程序的开发过程,对我深化理解Visual Basic语言的基础知识、提高综合运用所学知识的能力有着显著的作用。

4、一点意见:
    虽然课程设计意义非凡,但放在这个时间进行却对考研的学生影响巨大:现在正是考研的关键时期,但他们却不得不抽出宝贵的复习时间来进行程序设计、调式和设计报告,对研究生的录取有害无益。希望来年学校能为学生多着想一些,合理的安排课程设计的时间,这样对双方都有好处。


六、参考文献:
《Visual Basic 指南》  [王栋]主编  清华大学出版社
《中文VB6傻瓜书》      网上资料
《VB6循序渐进教程》    网上资料

    





⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -