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

📄 selectpath.vb

📁 一个用vb开发的档案管理程序
💻 VB
字号:
Option Strict Off
Option Explicit On
Friend Class SelectPath
	Inherits System.Windows.Forms.Form
#Region "Windows 窗体设计器生成的代码"
	Public Sub New()
		MyBase.New()
		If m_vb6FormDefInstance Is Nothing Then
			If m_InitializingDefInstance Then
				m_vb6FormDefInstance = Me
			Else
				Try 
					'对于启动窗体,所创建的第一个实例为默认实例。
					If System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType Is Me.GetType Then
						m_vb6FormDefInstance = Me
					End If
				Catch
				End Try
			End If
		End If
		'此调用是 Windows 窗体设计器所必需的。
		InitializeComponent()
	End Sub
	'窗体重写处置,以清理组件列表。
	Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
		If Disposing Then
			If Not components Is Nothing Then
				components.Dispose()
			End If
		End If
		MyBase.Dispose(Disposing)
	End Sub
	'Windows 窗体设计器所必需的
	Private components As System.ComponentModel.IContainer
	Public ToolTip1 As System.Windows.Forms.ToolTip
	Public WithEvents PathList As System.Windows.Forms.TextBox
	Public WithEvents Label1 As System.Windows.Forms.Label
	Public WithEvents Frame1 As System.Windows.Forms.GroupBox
	Public WithEvents NOOK As System.Windows.Forms.Button
	Public WithEvents OK As System.Windows.Forms.Button
	Public WithEvents Drive1 As Microsoft.VisualBasic.Compatibility.VB6.DriveListBox
	Public WithEvents Dir1 As Microsoft.VisualBasic.Compatibility.VB6.DirListBox
	'注意:以下过程是 Windows 窗体设计器所必需的
	'可以使用 Windows 窗体设计器来修改它。
	'不要使用代码编辑器来修改它。
	<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
		Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(SelectPath))
		Me.components = New System.ComponentModel.Container()
		Me.ToolTip1 = New System.Windows.Forms.ToolTip(components)
		Me.ToolTip1.Active = True
		Me.PathList = New System.Windows.Forms.TextBox
		Me.Frame1 = New System.Windows.Forms.GroupBox
		Me.Label1 = New System.Windows.Forms.Label
		Me.NOOK = New System.Windows.Forms.Button
		Me.OK = New System.Windows.Forms.Button
		Me.Drive1 = New Microsoft.VisualBasic.Compatibility.VB6.DriveListBox
		Me.Dir1 = New Microsoft.VisualBasic.Compatibility.VB6.DirListBox
		Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
		Me.Text = "请选择路径"
		Me.ClientSize = New System.Drawing.Size(305, 213)
		Me.Location = New System.Drawing.Point(3, 22)
		Me.Icon = CType(resources.GetObject("SelectPath.Icon"), System.Drawing.Icon)
		Me.MaximizeBox = False
		Me.MinimizeBox = False
		Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
		Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
		Me.BackColor = System.Drawing.SystemColors.Control
		Me.ControlBox = True
		Me.Enabled = True
		Me.KeyPreview = False
		Me.Cursor = System.Windows.Forms.Cursors.Default
		Me.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.ShowInTaskbar = True
		Me.HelpButton = False
		Me.WindowState = System.Windows.Forms.FormWindowState.Normal
		Me.Name = "SelectPath"
		Me.PathList.AutoSize = False
		Me.PathList.Size = New System.Drawing.Size(151, 21)
		Me.PathList.Location = New System.Drawing.Point(12, 20)
		Me.PathList.ReadOnly = True
		Me.PathList.TabIndex = 6
		Me.PathList.AcceptsReturn = True
		Me.PathList.TextAlign = System.Windows.Forms.HorizontalAlignment.Left
		Me.PathList.BackColor = System.Drawing.SystemColors.Window
		Me.PathList.CausesValidation = True
		Me.PathList.Enabled = True
		Me.PathList.ForeColor = System.Drawing.SystemColors.WindowText
		Me.PathList.HideSelection = True
		Me.PathList.Maxlength = 0
		Me.PathList.Cursor = System.Windows.Forms.Cursors.IBeam
		Me.PathList.MultiLine = False
		Me.PathList.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.PathList.ScrollBars = System.Windows.Forms.ScrollBars.None
		Me.PathList.TabStop = True
		Me.PathList.Visible = True
		Me.PathList.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
		Me.PathList.Name = "PathList"
		Me.Frame1.Size = New System.Drawing.Size(111, 92)
		Me.Frame1.Location = New System.Drawing.Point(177, 108)
		Me.Frame1.TabIndex = 4
		Me.Frame1.BackColor = System.Drawing.SystemColors.Control
		Me.Frame1.Enabled = True
		Me.Frame1.ForeColor = System.Drawing.SystemColors.ControlText
		Me.Frame1.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Frame1.Visible = True
		Me.Frame1.Name = "Frame1"
		Me.Label1.Text = "请选择要备份的数据磁盘和路径,然后按确定按钮,否则按取消按钮。"
		Me.Label1.ForeColor = System.Drawing.Color.FromARGB(0, 0, 64)
		Me.Label1.Size = New System.Drawing.Size(97, 63)
		Me.Label1.Location = New System.Drawing.Point(9, 25)
		Me.Label1.TabIndex = 5
		Me.Label1.TextAlign = System.Drawing.ContentAlignment.TopLeft
		Me.Label1.BackColor = System.Drawing.SystemColors.Control
		Me.Label1.Enabled = True
		Me.Label1.Cursor = System.Windows.Forms.Cursors.Default
		Me.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Label1.UseMnemonic = True
		Me.Label1.Visible = True
		Me.Label1.AutoSize = False
		Me.Label1.BorderStyle = System.Windows.Forms.BorderStyle.None
		Me.Label1.Name = "Label1"
		Me.NOOK.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
		Me.CancelButton = Me.NOOK
		Me.NOOK.Text = "取消(&C)"
		Me.NOOK.Size = New System.Drawing.Size(93, 27)
		Me.NOOK.Location = New System.Drawing.Point(189, 51)
		Me.NOOK.TabIndex = 1
		Me.NOOK.BackColor = System.Drawing.SystemColors.Control
		Me.NOOK.CausesValidation = True
		Me.NOOK.Enabled = True
		Me.NOOK.ForeColor = System.Drawing.SystemColors.ControlText
		Me.NOOK.Cursor = System.Windows.Forms.Cursors.Default
		Me.NOOK.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.NOOK.TabStop = True
		Me.NOOK.Name = "NOOK"
		Me.OK.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
		Me.OK.Text = "确定(&O)"
		Me.AcceptButton = Me.OK
		Me.OK.Size = New System.Drawing.Size(94, 27)
		Me.OK.Location = New System.Drawing.Point(189, 19)
		Me.OK.TabIndex = 0
		Me.OK.BackColor = System.Drawing.SystemColors.Control
		Me.OK.CausesValidation = True
		Me.OK.Enabled = True
		Me.OK.ForeColor = System.Drawing.SystemColors.ControlText
		Me.OK.Cursor = System.Windows.Forms.Cursors.Default
		Me.OK.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.OK.TabStop = True
		Me.OK.Name = "OK"
		Me.Drive1.Size = New System.Drawing.Size(150, 20)
		Me.Drive1.Location = New System.Drawing.Point(13, 179)
		Me.Drive1.TabIndex = 3
		Me.Drive1.BackColor = System.Drawing.SystemColors.Window
		Me.Drive1.CausesValidation = True
		Me.Drive1.Enabled = True
		Me.Drive1.ForeColor = System.Drawing.SystemColors.WindowText
		Me.Drive1.Cursor = System.Windows.Forms.Cursors.Default
		Me.Drive1.TabStop = True
		Me.Drive1.Visible = True
		Me.Drive1.Name = "Drive1"
		Me.Dir1.Size = New System.Drawing.Size(150, 118)
		Me.Dir1.Location = New System.Drawing.Point(13, 51)
		Me.Dir1.TabIndex = 2
		Me.Dir1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
		Me.Dir1.BackColor = System.Drawing.SystemColors.Window
		Me.Dir1.CausesValidation = True
		Me.Dir1.Enabled = True
		Me.Dir1.ForeColor = System.Drawing.SystemColors.WindowText
		Me.Dir1.Cursor = System.Windows.Forms.Cursors.Default
		Me.Dir1.TabStop = True
		Me.Dir1.Visible = True
		Me.Dir1.Name = "Dir1"
		Me.Controls.Add(PathList)
		Me.Controls.Add(Frame1)
		Me.Controls.Add(NOOK)
		Me.Controls.Add(OK)
		Me.Controls.Add(Drive1)
		Me.Controls.Add(Dir1)
		Me.Frame1.Controls.Add(Label1)
	End Sub
#End Region 
#Region "升级支持"
	Private Shared m_vb6FormDefInstance As SelectPath
	Private Shared m_InitializingDefInstance As Boolean
	Public Shared Property DefInstance() As SelectPath
		Get
			If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
				m_InitializingDefInstance = True
				m_vb6FormDefInstance = New SelectPath()
				m_InitializingDefInstance = False
			End If
			DefInstance = m_vb6FormDefInstance
		End Get
		Set
			m_vb6FormDefInstance = Value
		End Set
	End Property
#End Region 
	Private Sub Dir1_Change(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Dir1.Change
		PathList.Text = Dir1.Path
	End Sub
	
	Private Sub Drive1_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Drive1.SelectedIndexChanged
		On Error GoTo Noread
		Dir1.Path = Drive1.Drive
		Exit Sub
Noread: 
		Dim Okread As Short
		Okread = MsgBox("" & Drive1.Drive & " 驱动器没有准备好!", MsgBoxStyle.RetryCancel + 16, "驱动器没有准备好!")
		If Okread = 4 Then
			Call Drive1_SelectedIndexChanged(Drive1, New System.EventArgs())
		Else
			Drive1.Drive = Dir1.Path
		End If
	End Sub
	
	Private Sub SelectPath_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
		PathList.Text = Dir1.Path
	End Sub
	
	Private Sub NOOK_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles NOOK.Click
		Me.Close()
	End Sub
	
	Private Sub OK_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles OK.Click
		Dim BackUp As Object
		'UPGRADE_WARNING: 未能解析对象 BackUp.Text1 的默认属性。 单击以获得更多信息:'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1037"'
		BackUp.Text1.Text = PathList.Text
		Me.Close()
	End Sub
End Class

⌨️ 快捷键说明

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