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

📄 frmcontrols.frm

📁 Visual Basic 6 大学教程的代码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmControls 
   Caption         =   "Fig. 14.4: DirListBox, FileListBox, DriveListBox"
   ClientHeight    =   2925
   ClientLeft      =   1860
   ClientTop       =   2145
   ClientWidth     =   5385
   LinkTopic       =   "Form1"
   ScaleHeight     =   2925
   ScaleWidth      =   5385
   Begin VB.FileListBox filFileBox 
      Height          =   2430
      Left            =   3135
      TabIndex        =   2
      Top             =   390
      Width           =   2160
   End
   Begin VB.DirListBox dirDirBox 
      Height          =   1665
      Left            =   135
      TabIndex        =   1
      Top             =   1080
      Width           =   2790
   End
   Begin VB.DriveListBox drvDriveBox 
      Height          =   315
      Left            =   150
      TabIndex        =   0
      Top             =   405
      Width           =   2460
   End
   Begin VB.Label lblLabel 
      Caption         =   "DriveListBox:"
      Height          =   240
      Left            =   150
      TabIndex        =   5
      Top             =   180
      Width           =   1455
   End
   Begin VB.Label lblLabel2 
      Caption         =   "FileListBox:"
      Height          =   255
      Left            =   3135
      TabIndex        =   4
      Top             =   165
      Width           =   1650
   End
   Begin VB.Label lblLabel1 
      Caption         =   "DirListBox:"
      Height          =   330
      Left            =   150
      TabIndex        =   3
      Top             =   870
      Width           =   2775
   End
End
Attribute VB_Name = "frmControls"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Fig. 14.4
' Demonstrating FileListBox, DirListBox,
' and DriveListBox controls
Option Explicit      ' General declaration

Private Sub dirDirBox_Change()
   
   ' Update the file path to the directory path
   filFileBox.Path = dirDirBox.Path
End Sub

Private Sub drvDriveBox_Change()

   On Error GoTo errorhandler
   
      ' Update the directory path to the drive
      dirDirBox.Path = drvDriveBox.Drive
      Exit Sub
      
errorhandler:
      Dim message As String
      
      ' Check for device unavailable error
      If Err.Number = 68 Then
         Dim r As Integer
         
         message = "Drive is not available."
         r = MsgBox(message, vbRetryCancel + vbCritical, _
                    "VBHTP: Chapter 14")
                    
         ' Determine where control should resume
         If r = vbRetry Then
            Resume
         Else   ' Cancel was pressed.
            drvDriveBox.Drive = drvDriveBox.List(1)
            Resume Next
         End If
         
      Else
         Call MsgBox(Err.Description, vbOKOnly + vbExclamation)
         Resume Next
      End If
      
End Sub

⌨️ 快捷键说明

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