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

📄 mdiform1.frm

📁 车票信息系统用于vb课程设计是初级软件
💻 FRM
字号:
VERSION 5.00
Begin VB.MDIForm 主窗体 
   BackColor       =   &H8000000C&
   Caption         =   "MDIForm1"
   ClientHeight    =   3345
   ClientLeft      =   165
   ClientTop       =   825
   ClientWidth     =   6630
   LinkTopic       =   "MDIForm1"
   Picture         =   "MDIForm1.frx":0000
   StartUpPosition =   3  '窗口缺省
   Begin VB.Menu 登录与注销 
      Caption         =   "登录与注销"
      Begin VB.Menu 登录 
         Caption         =   "登录"
      End
      Begin VB.Menu 注销 
         Caption         =   "注销"
      End
      Begin VB.Menu 退出 
         Caption         =   "退出"
      End
   End
   Begin VB.Menu 线路 
      Caption         =   "线路"
      Begin VB.Menu 线路操作 
         Caption         =   "线路操作"
      End
   End
   Begin VB.Menu 汽车信息 
      Caption         =   "汽车信息"
      Begin VB.Menu 汽车操作 
         Caption         =   "汽车操作"
      End
   End
   Begin VB.Menu 车票信息 
      Caption         =   "车票信息"
   End
   Begin VB.Menu 用户管理 
      Caption         =   "用户管理"
      Begin VB.Menu 修改密码 
         Caption         =   "修改密码"
      End
      Begin VB.Menu 添加用户 
         Caption         =   "添加用户"
      End
   End
   Begin VB.Menu 打印信息 
      Caption         =   "打印信息"
      Begin VB.Menu 打印线路信息 
         Caption         =   "打印线路信息"
      End
      Begin VB.Menu 打印汽车信息 
         Caption         =   "打印汽车信息"
      End
      Begin VB.Menu 打印车票信息 
         Caption         =   "打印车票信息"
      End
   End
   Begin VB.Menu 帮助 
      Caption         =   "帮助"
      Begin VB.Menu 关于 
         Caption         =   "关于"
      End
   End
End
Attribute VB_Name = "主窗体"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Private Sub MDIForm_Load()
   Me.Width = Screen.Width
   Me.Height = Screen.Height
   refreshmenu ("initial")
End Sub

'通过根据权限改变菜单可用状态的方式来达到权限控件的目的
Public Sub refreshmenu(auth As String)
   If auth = "initial" Then
    登录.Enabled = True
    注销.Enabled = False
     退出.Enabled = False
    线路.Enabled = False
    汽车信息.Enabled = False
    用户管理.Enabled = False
    打印信息.Enabled = False
    
     车票信息.Enabled = False
     
     线路操作.Enabled = False
End If
   If auth = "0" Then
     退出.Enabled = True
     登录.Enabled = False
    注销.Enabled = True
     线路.Enabled = True
    汽车信息.Enabled = True
     车票信息.Enabled = True
     用户管理.Enabled = True
     修改密码.Enabled = True
     添加用户.Enabled = True
    打印信息.Enabled = True
     
    线路操作.Enabled = True
     'mnuRpt1.Enabled = True
    ' mnuRpt2.Enabled = True
   End If
   If auth = "1" Then
     退出.Enabled = True
     登录.Enabled = False
    注销.Enabled = True
     线路.Enabled = True
     汽车信息.Enabled = True
     车票信息.Enabled = True
     
     线路操作.Enabled = True
       用户管理.Enabled = True
     修改密码.Enabled = True
     添加用户.Enabled = True
    打印信息.Enabled = True
    
     'mnuRpt1.Enabled = False
     
   End If
   
End Sub

Private Sub 车票信息_Click()
车票.Show

End Sub

Private Sub 打印车票信息_Click()
 'rptBook.Show
   Dim i, j As Integer
   Dim rowcount, colcount As Integer
   Dim xlapp As Object
   Dim xlbook As Excel.Workbook
   Dim xlsheet As Excel.Worksheet
   
   cnn.Open myApp.cnnstr
   cnn.CursorLocation = adUseClient
   rst.Open "select * from 车票", cnn, 1, 3
   If rst.RecordCount < 1 Then
      MsgBox ("没有记录!")
      Exit Sub
   End If
   '记录总数
   rowcount = rst.RecordCount
   '字段总数
   colcount = rst.Fields.Count
   
   
   Set xlapp = CreateObject("excel.application")
   Set xlbook = Nothing
   Set xlsheet = Nothing
   Set xlbook = xlapp.Workbooks().Add
   Set xlsheet = xlbook.Worksheets("sheet1")
   xlsheet.Rows("4:4").RowHeight = 15
         xlsheet.Columns("B:B").ColumnWidth = 15
          xlsheet.Rows("4:4").RowHeight = 15
         xlsheet.Columns("C:C").ColumnWidth = 15
          xlsheet.Rows("4:4").RowHeight = 15
         xlsheet.Columns("A:A").ColumnWidth = 15
          xlsheet.Rows("4:4").RowHeight = 15
         xlsheet.Columns("D:D").ColumnWidth = 15
          xlsheet.Rows("4:4").RowHeight = 15
         xlsheet.Columns("E:E").ColumnWidth = 15
          xlsheet.Rows("4:4").RowHeight = 15
         xlsheet.Columns("F:F").ColumnWidth = 15
          xlsheet.Rows("4:4").RowHeight = 15
         xlsheet.Columns("G:G").ColumnWidth = 15
          xlsheet.Rows("4:4").RowHeight = 15
         xlsheet.Columns("H:H").ColumnWidth = 15
   xlapp.Visible = True
   
   '输出报表的标题
   With xlsheet
      .Range(.Cells(1, 1), .Cells(2, colcount)).MergeCells = True '合并单元格
      .Cells(1, 1).Font.Name = "黑体" '字体
      .Cells(1, 1).Font.Bold = True '加粗
      .Cells(1, 1).Font.Size = 25 '大小
      .Cells(1, 1).VerticalAlignment = xlCenter '垂直居中
      .Cells(1, 1).HorizontalAlignment = xlCenter '水平居中
      .Cells(1, 1).ShrinkToFit = True '字体大小自动调整
      .Cells(1, 1) = "车票信息" '标题内容
      
   End With
   
   '输出列名
   With xlsheet
      .Range(.Cells(3, 1), .Cells(3, colcount)).Font.Name = "黑体"
      .Range(.Cells(3, 1), .Cells(3, colcount)).Font.Bold = True
      .Range(.Cells(3, 1), .Cells(3, colcount)).ShrinkToFit = True
       .Range(.Cells(3, 1), .Cells(3, colcount)).Font.Size = 12
      .Range(.Cells(3, 1), .Cells(3, colcount)).HorizontalAlignment = xlCenter '水平居中
      .Range(.Cells(3, 1), .Cells(3, colcount)).HorizontalAlignment = xlCenter '水平居中
      For j = 0 To colcount - 1
          .Cells(3, j + 1) = rst.Fields(j).Name '输出列名
      Next j
   End With
   
   '输出车票信息
   xlsheet.Range(xlsheet.Cells(4, 1), xlsheet.Cells(4 + rowcount - 1, colcount)).VerticalAlignment = xlCenter
   xlsheet.Range(xlsheet.Cells(4, 1), xlsheet.Cells(4 + rowcount - 1, colcount)).HorizontalAlignment = xlCenter
   xlsheet.Range(xlsheet.Cells(1, 1), xlsheet.Cells(4 + rowcount - 1, colcount)).Borders.LineStyle = xlContinuous
   For i = 4 To 4 + rowcount - 1
       For j = 1 To colcount
          xlsheet.Cells(i, j) = rst.Fields(j - 1).Value '输出车票信息
       Next j
       rst.MoveNext
   Next i
   'xlsheet.PrintPreview '打印预览
   'xlsheet.PrintOut '打印
   'xlapp.Application.DisplayAlerts = False '不提示用户信息
   'xlapp.Application.Workbooks.Close 'SaveChanges:=False
   Set xlapp = Nothing
   Set xlbook = Nothing
   Set xlsheet = Nothing
   cnn.Close
End Sub

Private Sub 打印线路信息_Click()
   'rptBook.Show
   Dim i, j As Integer
   Dim rowcount, colcount As Integer
   Dim xlapp As Object
   Dim xlbook As Excel.Workbook
   Dim xlsheet As Excel.Worksheet
   
   cnn.Open myApp.cnnstr
   cnn.CursorLocation = adUseClient
   rst.Open "select * from 线路", cnn, 1, 3
   If rst.RecordCount < 1 Then
      MsgBox ("没有记录!")
      Exit Sub
   End If
   '记录总数
   rowcount = rst.RecordCount
   '字段总数
   colcount = rst.Fields.Count
   
   
   Set xlapp = CreateObject("excel.application")
   Set xlbook = Nothing
   Set xlsheet = Nothing
   Set xlbook = xlapp.Workbooks().Add
   Set xlsheet = xlbook.Worksheets("sheet1")
   xlsheet.Rows("4:4").RowHeight = 15
         xlsheet.Columns("B:B").ColumnWidth = 15
          xlsheet.Rows("4:4").RowHeight = 15
         xlsheet.Columns("C:C").ColumnWidth = 15
          xlsheet.Rows("4:4").RowHeight = 15
         xlsheet.Columns("A:A").ColumnWidth = 15
          xlsheet.Rows("4:4").RowHeight = 15
         xlsheet.Columns("D:D").ColumnWidth = 15
          xlsheet.Rows("4:4").RowHeight = 15
         xlsheet.Columns("E:E").ColumnWidth = 15
          xlsheet.Rows("4:4").RowHeight = 15
         xlsheet.Columns("F:F").ColumnWidth = 15
          xlsheet.Rows("4:4").RowHeight = 15
         xlsheet.Columns("G:G").ColumnWidth = 15
          xlsheet.Rows("4:4").RowHeight = 15
         xlsheet.Columns("H:H").ColumnWidth = 15
   xlapp.Visible = True
   
   '输出报表的标题
   With xlsheet
      .Range(.Cells(1, 1), .Cells(2, colcount)).MergeCells = True '合并单元格
      .Cells(1, 1).Font.Name = "黑体" '字体
      .Cells(1, 1).Font.Bold = True '加粗
      .Cells(1, 1).Font.Size = 24 '大小
      .Cells(1, 1).VerticalAlignment = xlCenter '垂直居中
      .Cells(1, 1).HorizontalAlignment = xlCenter '水平居中
      .Cells(1, 1).ShrinkToFit = True '字体大小自动调整
      .Cells(1, 1) = "线路信息" '标题内容
      
   End With
   
   '输出列名
   With xlsheet
      .Range(.Cells(3, 1), .Cells(3, colcount)).Font.Name = "黑体"
      .Range(.Cells(3, 1), .Cells(3, colcount)).Font.Bold = True
      .Range(.Cells(3, 1), .Cells(3, colcount)).ShrinkToFit = True
      .Range(.Cells(3, 1), .Cells(3, colcount)).Font.Size = 12
      .Range(.Cells(3, 1), .Cells(3, colcount)).HorizontalAlignment = xlCenter '水平居中
      .Range(.Cells(3, 1), .Cells(3, colcount)).HorizontalAlignment = xlCenter '水平居中
      For j = 0 To colcount - 1
          .Cells(3, j + 1) = rst.Fields(j).Name '输出列名
      Next j
   End With
   
   '输出线路信息
   xlsheet.Range(xlsheet.Cells(4, 1), xlsheet.Cells(4 + rowcount - 1, colcount)).VerticalAlignment = xlCenter
   xlsheet.Range(xlsheet.Cells(4, 1), xlsheet.Cells(4 + rowcount - 1, colcount)).HorizontalAlignment = xlCenter
   xlsheet.Range(xlsheet.Cells(1, 1), xlsheet.Cells(4 + rowcount - 1, colcount)).Borders.LineStyle = xlContinuous
   For i = 4 To 4 + rowcount - 1
       For j = 1 To colcount
          xlsheet.Cells(i, j) = rst.Fields(j - 1).Value '输出线路信息
       Next j
       rst.MoveNext
   Next i
   'xlsheet.PrintPreview '打印预览
   'xlsheet.PrintOut '打印
   'xlapp.Application.DisplayAlerts = False '不提示用户信息
   'xlapp.Application.Workbooks.Close 'SaveChanges:=False
   Set xlapp = Nothing
   Set xlbook = Nothing
   Set xlsheet = Nothing
   cnn.Close
End Sub

Private Sub 打印汽车信息_Click()
   'rptBook.Show
   Dim i, j As Integer
   Dim rowcount, colcount As Integer
   Dim xlapp As Object
   Dim xlbook As Excel.Workbook
   Dim xlsheet As Excel.Worksheet
   
   cnn.Open myApp.cnnstr
   cnn.CursorLocation = adUseClient
   rst.Open "select * from 汽车", cnn, 1, 3
   If rst.RecordCount < 1 Then
      MsgBox ("没有记录!")
      Exit Sub
   End If
   '记录总数
   rowcount = rst.RecordCount
   '字段总数
   colcount = rst.Fields.Count
   
   
   Set xlapp = CreateObject("excel.application")
   Set xlbook = Nothing
   Set xlsheet = Nothing
   Set xlbook = xlapp.Workbooks().Add
   Set xlsheet = xlbook.Worksheets("sheet1")
   xlsheet.Rows("4:4").RowHeight = 15
         xlsheet.Columns("B:B").ColumnWidth = 15
          xlsheet.Rows("4:4").RowHeight = 15
         xlsheet.Columns("C:C").ColumnWidth = 15
          xlsheet.Rows("4:4").RowHeight = 15
         xlsheet.Columns("A:A").ColumnWidth = 15
          xlsheet.Rows("4:4").RowHeight = 15
         xlsheet.Columns("D:D").ColumnWidth = 15
          xlsheet.Rows("4:4").RowHeight = 15
         xlsheet.Columns("E:E").ColumnWidth = 15
          xlsheet.Rows("4:4").RowHeight = 15
         xlsheet.Columns("F:F").ColumnWidth = 15
          xlsheet.Rows("4:4").RowHeight = 15
         xlsheet.Columns("G:G").ColumnWidth = 15
          xlsheet.Rows("4:4").RowHeight = 15
         xlsheet.Columns("H:H").ColumnWidth = 15
   xlapp.Visible = True
   
   '输出报表的标题
   With xlsheet
      .Range(.Cells(1, 1), .Cells(2, colcount)).MergeCells = True '合并单元格
      .Cells(1, 1).Font.Name = "黑体" '字体
      .Cells(1, 1).Font.Bold = True '加粗
     .Cells(1, 1).Font.Size = 25 '大小
      .Cells(1, 1).VerticalAlignment = xlCenter '垂直居中
      .Cells(1, 1).HorizontalAlignment = xlCenter '水平居中
      .Cells(1, 1).ShrinkToFit = True '字体大小自动调整
      .Cells(1, 1) = "汽车信息" '标题内容
      
   End With
   
   '输出列名
   With xlsheet
      .Range(.Cells(3, 1), .Cells(3, colcount)).Font.Name = "黑体"
      .Range(.Cells(3, 1), .Cells(3, colcount)).Font.Bold = True
      .Range(.Cells(3, 1), .Cells(3, colcount)).ShrinkToFit = True
       .Range(.Cells(3, 1), .Cells(3, colcount)).Font.Size = 12
      .Range(.Cells(3, 1), .Cells(3, colcount)).HorizontalAlignment = xlCenter '水平居中
      .Range(.Cells(3, 1), .Cells(3, colcount)).HorizontalAlignment = xlCenter '水平居中
      For j = 0 To colcount - 1
          .Cells(3, j + 1) = rst.Fields(j).Name '输出列名
      Next j
   End With
   
   '输出汽车信息
   xlsheet.Range(xlsheet.Cells(4, 1), xlsheet.Cells(4 + rowcount - 1, colcount)).VerticalAlignment = xlCenter
   xlsheet.Range(xlsheet.Cells(4, 1), xlsheet.Cells(4 + rowcount - 1, colcount)).HorizontalAlignment = xlCenter
   xlsheet.Range(xlsheet.Cells(1, 1), xlsheet.Cells(4 + rowcount - 1, colcount)).Borders.LineStyle = xlContinuous
   For i = 4 To 4 + rowcount - 1
       For j = 1 To colcount
          xlsheet.Cells(i, j) = rst.Fields(j - 1).Value '输出汽车信息
       Next j
       rst.MoveNext
   Next i
   'xlsheet.PrintPreview '打印预览
   'xlsheet.PrintOut '打印
   'xlapp.Application.DisplayAlerts = False '不提示用户信息
   'xlapp.Application.Workbooks.Close 'SaveChanges:=False
   Set xlapp = Nothing
   Set xlbook = Nothing
   Set xlsheet = Nothing
   cnn.Close
End Sub


Private Sub 关于_Click()
  MsgBox "长途汽车信息管理系统" & Chr(10) & Chr(13) & "班级:信管051" & Chr(10) & Chr(13) & "作者:李刚、蒋海波、马挺江、叶芬芬" & Chr(10) & Chr(13) & "版权所有", vbInformation, "关于..."
End Sub



Private Sub 汽车操作_Click()
  汽车.Show
End Sub

Private Sub 线路操作_Click()
   线路1.Show
End Sub



Private Sub 登录_Click()
   登录1.Show
End Sub

Private Sub 修改密码_Click()
修改密码1.Show
End Sub

Private Sub 注销_Click()
   refreshmenu ("initial")
   myApp.logined = False
End Sub


Private Sub 退出_Click()
   End
End Sub




Private Sub mnuRpt2_Click()
   frmStatSale.Show
   
End Sub


Private Sub mnuUsers_Click()
   frmUsers.Show
End Sub

⌨️ 快捷键说明

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