毕业论文论文范文课程设计实践报告法律论文英语论文教学论文医学论文农学论文艺术论文行政论文管理论文计算机安全
您现在的位置: 毕业论文 >> 论文 >> 正文

VB航空公司管理信息系统 第6页

更新时间:2010-3-7:  来源:毕业论文
VB航空公司管理信息系统 第6页
  .RowSel = 1
        .ColSel = .Cols - 1
        .CellAlignment = 4
        '设置单元大小
        .ColWidth(0) = 1000
        .ColWidth(1) = 1000
        .ColWidth(2) = 2000
        .ColWidth(3) = 1000
        .ColWidth(4) = 1000
        .ColWidth(5) = 1000
        .ColWidth(6) = 1000
        .ColWidth(7) = 1000
        .ColWidth(8) = 1000
        .ColWidth(9) = 1000
        .ColWidth(10) = 1000
        .ColWidth(11) = 1000
        .Row = 1
    End With
End Sub
函数ShowData把各条记录加到表格中,并显示出来,代码如下:
Private Sub ShowData()
    Dim j As Integer

    Dim i As Integer
    Dim MsgText As String
‘获得数据集
    Set mrc = ExecuteSQL(txtSQL, MsgText)
        With msgList
        .Rows = 1
        ‘判断是否为空
        Do While Not mrc.EOF
            ‘移动到下一行
            .Rows = .Rows + 1
            ‘循环
            For i = 1 To mrc.Fields.Count
                ‘判断是否为空
                If Not IsNull(Trim(mrc.Fields(i - 1))) Then
                ‘根据数据类型显示
                Select Case mrc.Fields(i - 1).Type
                    Case adDBDate
                        .TextMatrix(.Rows - 1, i) = Format(mrc.Fields(i - 1) & "", "yyyy-mm-dd")
                    Case Else
                        .TextMatrix(.Rows - 1, i) = mrc.Fields(i - 1) & ""
                End Select
                End If
            Next I
            ‘移动到下一条记录
            mrc.MoveNext
        Loop
    End With
    ‘关闭数据集对象
    mrc.Close
End Sub
在窗体显示时,可以控制窗体中各个控件按照要求的位置显示。可以在窗体的Resize事件中加入代码,代码如下:
Private Sub Form_Resize()
     ‘判断当前窗体所处的状态,当前窗体不处于最小化状态并且主窗体不处于最小化状态时进行后面的操作
    If Me.WindowState <> vbMinimized And fMainForm.WindowState <> vbMinimized Then
        '边界处理
        If Me.ScaleHeight < 10 * lblTitle.Height Then
            Exit Sub

        End If
        If Me.ScaleWidth < lblTitle.Width + lblTitle.Width / 2 Then
            Exit Sub
        End If
        '控制控件的位置
        lblTitle.Top = lblTitle.Height
        lblTitle.Left = (Me.Width - lblTitle.Width) / 2
        ‘控制表格控件的位置
        msgList.Top = lblTitle.Top + lblTitle.Height + lblTitle.Height / 2
        msgList.Width = Me.ScaleWidth - 200
        msgList.Left = Me.ScaleLeft + 100
        msgList.Height = Me.ScaleHeight - msgList.Top - 1500
        ‘控制按钮位置
        Frame2.Top = msgList.Top + msgList.Height + 50
        Frame2.Left = Me.ScaleWidth / 2 - 3000
    End If
End Sub
6.2 添加舱位信息窗体的创建
在舱位信息显示窗体中单击“添加”按钮,将出现如图9-13所示的窗体。
 
图9-13 添加舱位等级信息窗体
载入窗体时,首先根据标志变量判断状态,然后决定是添加还是修改,代码如下:
Private Sub Form_Load()
    Dim intCount As Integer
    Dim MsgText As String
    Dim i As Integer
    ‘判断是否为添加
    If gintSmode = 1 Then
        Me.Caption = Me.Caption & "添加"
        For i = 0 To 7
            Combo1(i).AddItem "否"
            Combo1(i).AddItem "是"
            Combo1(i).ListIndex = 0
        Next I
    ‘载入当前选择记录内容
    ElseIf gintSmode = 2 Then
        Set mrc = ExecuteSQL(txtSQL, MsgText)
        ‘判断记录是否为空
        If mrc.EOF = False Then
            With mrc
                For intCount = 0 To 1
                    txtItem(intCount) = .Fields(intCount)
                Next intCount
                txtItem(2) = .Fields(10)
                For i = 0 To 7
                    Combo1(i).AddItem "否"
                    Combo1(i).AddItem "是"
                    Combo1(i).ListIndex = 0
                Next i
            End With
            txtItem(0).Enabled = False
        End If
        Me.Caption = Me.Caption & "修改"
    End If
    mblChange = False
End Sub
输入内容完毕,单击“保存”按钮,将首先判断输入内容是否满足要求,然后添加到数据库中。代码如下:
Private Sub cmdSave_Click()
    Dim intCount As Integer
    Dim sMeg As String
    Dim MsgText As String
    ‘判断输入内容是否为空
    For intCount = 0 To 1
        If Trim(txtItem(intCount) & " ") = "" Then
            Select Case intCount
                Case 0
                    sMeg = "机舱等级编号"
                Case 1
                    sMeg = "机舱等级名称"
            End Select
            sMeg = sMeg & "不能为空!"
            MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
            txtItem(intCount).SetFocus
            Exit Sub
        End If

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ... 下一页  >> 

VB航空公司管理信息系统 第6页下载如图片无法显示或论文不完整,请联系qq752018766
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©751com.cn 辣文论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。