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

📄 frmsearchform.vb

📁 一个用vb开发的档案管理程序
💻 VB
📖 第 1 页 / 共 2 页
字号:
		Me.Line4.Name = "Line4"
		Me.Line6.BackColor = System.Drawing.Color.FromARGB(128, 128, 128)
		Me.Line6.Visible = True
		Me.Line6.Location = New System.Drawing.Point(-2, 3)
		Me.Line6.Width = 389
		Me.Line6.Height = 1
		Me.Line6.Name = "Line6"
		Me.Line7.BackColor = System.Drawing.Color.White
		Me.Line7.Visible = True
		Me.Line7.Location = New System.Drawing.Point(11, 54)
		Me.Line7.Width = 386
		Me.Line7.Height = 1
		Me.Line7.Name = "Line7"
		Me.Line5.BackColor = System.Drawing.Color.White
		Me.Line5.Visible = True
		Me.Line5.Location = New System.Drawing.Point(396, 10)
		Me.Line5.Width = 1
		Me.Line5.Height = 44
		Me.Line5.Name = "Line5"
		Me._Line3_1.BackColor = System.Drawing.Color.FromARGB(224, 224, 224)
		Me._Line3_1.Visible = True
		Me._Line3_1.Location = New System.Drawing.Point(409, 0)
		Me._Line3_1.Width = 1
		Me._Line3_1.Height = 110
		Me._Line3_1.Name = "_Line3_1"
		Me._Line2_1.BackColor = System.Drawing.Color.FromARGB(128, 128, 128)
		Me._Line2_1.Visible = True
		Me._Line2_1.Location = New System.Drawing.Point(408, 0)
		Me._Line2_1.Width = 1
		Me._Line2_1.Height = 108
		Me._Line2_1.Name = "_Line2_1"
		Me._Line3_0.BackColor = System.Drawing.Color.FromARGB(224, 224, 224)
		Me._Line3_0.Visible = True
		Me._Line3_0.Location = New System.Drawing.Point(2, 1)
		Me._Line3_0.Width = 1
		Me._Line3_0.Height = 106
		Me._Line3_0.Name = "_Line3_0"
		Me._Line2_0.BackColor = System.Drawing.Color.FromARGB(128, 128, 128)
		Me._Line2_0.Visible = True
		Me._Line2_0.Location = New System.Drawing.Point(1, 0)
		Me._Line2_0.Width = 1
		Me._Line2_0.Height = 109
		Me._Line2_0.Name = "_Line2_0"
		Me._Line1_3.BackColor = System.Drawing.Color.FromARGB(128, 128, 128)
		Me._Line1_3.Visible = True
		Me._Line1_3.Location = New System.Drawing.Point(3, 108)
		Me._Line1_3.Width = 406
		Me._Line1_3.Height = 1
		Me._Line1_3.Name = "_Line1_3"
		Me._Line1_2.BackColor = System.Drawing.Color.FromARGB(224, 224, 224)
		Me._Line1_2.Visible = True
		Me._Line1_2.Location = New System.Drawing.Point(2, 109)
		Me._Line1_2.Width = 406
		Me._Line1_2.Height = 1
		Me._Line1_2.Name = "_Line1_2"
		Me._Line1_1.BackColor = System.Drawing.Color.FromARGB(224, 224, 224)
		Me._Line1_1.Visible = True
		Me._Line1_1.Location = New System.Drawing.Point(3, 1)
		Me._Line1_1.Width = 404
		Me._Line1_1.Height = 1
		Me._Line1_1.Name = "_Line1_1"
		Me._Line1_0.BackColor = System.Drawing.Color.FromARGB(128, 128, 128)
		Me._Line1_0.Visible = True
		Me._Line1_0.Location = New System.Drawing.Point(1, 0)
		Me._Line1_0.Width = 407
		Me._Line1_0.Height = 1
		Me._Line1_0.Name = "_Line1_0"
		Me.Label1.Text = "请输入查询的条件:"
		Me.Label1.ForeColor = System.Drawing.Color.Black
		Me.Label1.Size = New System.Drawing.Size(108, 12)
		Me.Label1.Location = New System.Drawing.Point(20, 72)
		Me.Label1.TabIndex = 6
		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 = True
		Me.Label1.BorderStyle = System.Windows.Forms.BorderStyle.None
		Me.Label1.Name = "Label1"
		Me.Controls.Add(cmdSearch)
		Me.Controls.Add(txtSearch)
		Me.Controls.Add(Frame1)
		Me.Controls.Add(Line7)
		Me.Controls.Add(Line5)
		Me.Controls.Add(_Line3_1)
		Me.Controls.Add(_Line2_1)
		Me.Controls.Add(_Line3_0)
		Me.Controls.Add(_Line2_0)
		Me.Controls.Add(_Line1_3)
		Me.Controls.Add(_Line1_2)
		Me.Controls.Add(_Line1_1)
		Me.Controls.Add(_Line1_0)
		Me.Controls.Add(Label1)
		Me.Frame1.Controls.Add(_chkValue_1)
		Me.Frame1.Controls.Add(_chkValue_3)
		Me.Frame1.Controls.Add(_chkValue_4)
		Me.Frame1.Controls.Add(_chkValue_2)
		Me.Frame1.Controls.Add(Line4)
		Me.Frame1.Controls.Add(Line6)
		Me.Line1.SetIndex(_Line1_3, CType(3, Short))
		Me.Line1.SetIndex(_Line1_2, CType(2, Short))
		Me.Line1.SetIndex(_Line1_1, CType(1, Short))
		Me.Line1.SetIndex(_Line1_0, CType(0, Short))
		Me.Line2.SetIndex(_Line2_1, CType(1, Short))
		Me.Line2.SetIndex(_Line2_0, CType(0, Short))
		Me.Line3.SetIndex(_Line3_1, CType(1, Short))
		Me.Line3.SetIndex(_Line3_0, CType(0, Short))
		Me.chkValue.SetIndex(_chkValue_1, CType(1, Short))
		Me.chkValue.SetIndex(_chkValue_3, CType(3, Short))
		Me.chkValue.SetIndex(_chkValue_4, CType(4, Short))
		Me.chkValue.SetIndex(_chkValue_2, CType(2, Short))
		CType(Me.chkValue, System.ComponentModel.ISupportInitialize).EndInit()
		CType(Me.Line3, System.ComponentModel.ISupportInitialize).EndInit()
		CType(Me.Line2, System.ComponentModel.ISupportInitialize).EndInit()
		CType(Me.Line1, System.ComponentModel.ISupportInitialize).EndInit()
	End Sub
#End Region 
#Region "升级支持"
	Private Shared m_vb6FormDefInstance As frmSearchForm
	Private Shared m_InitializingDefInstance As Boolean
	Public Shared Property DefInstance() As frmSearchForm
		Get
			If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
				m_InitializingDefInstance = True
				m_vb6FormDefInstance = New frmSearchForm()
				m_InitializingDefInstance = False
			End If
			DefInstance = m_vb6FormDefInstance
		End Get
		Set
			m_vb6FormDefInstance = Value
		End Set
	End Property
#End Region 
	Private Sub cmdSearch_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdSearch.Click
		
		'检查选项
		Dim optSelect As Boolean
		Dim X As Short
		
		For X = 1 To 4
			If chkValue(X).CheckState = System.Windows.Forms.CheckState.Checked Then
				optSelect = True
			End If
		Next 
		
		If optSelect = False Then
			MsgBox("请您选择一个查询项目:" & vbCrLf & vbCrLf & "如:档案名、文件名、档案说明等等...    ", MsgBoxStyle.Information)
			Exit Sub
		End If
		
		Dim strTemp, lblTemp As String
		strTemp = " And ("
		
		For X = 1 To 4
			If chkValue(X).Text = "档案名" Then
				lblTemp = "档案号"
			Else
				lblTemp = chkValue(X).Text
			End If
			
			If chkValue(X).CheckState = System.Windows.Forms.CheckState.Checked Then
				If strTemp = " And (" Then
					strTemp = strTemp & lblTemp & " Like '*" & Trim(txtSearch.Text) & "*'"
				Else
					strTemp = strTemp & " Or " & lblTemp & " Like '*" & Trim(txtSearch.Text) & "*'"
				End If
			End If
		Next 
		
		strSearchString = strTemp & ")" '搜索代码
		Call frmManager.DefInstance.cmdLoad_Click() '刷新数据
		
		Me.Close()
		
	End Sub
	
	Private Sub frmSearchForm_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
		
		Me.Left = VB6.TwipsToPixelsX(Val(GetSetting(VB6.GetExeName(), "SearchForm", "Left")))
		Me.Top = VB6.TwipsToPixelsY(Val(GetSetting(VB6.GetExeName(), "SearchForm", "Top")))
		
	End Sub
	
	'UPGRADE_WARNING: Form 事件 frmSearchForm.Unload 具有新的行为。 单击以获得更多信息:'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup2065"'
	Private Sub frmSearchForm_Closed(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Closed
		
		SaveSetting(VB6.GetExeName(), "SearchForm", "Left", CStr(VB6.PixelsToTwipsX(Me.Left)))
		SaveSetting(VB6.GetExeName(), "SearchForm", "Top", CStr(VB6.PixelsToTwipsY(Me.Top)))
		
	End Sub
	
	'UPGRADE_WARNING: 初始化窗体时可能激发事件 txtSearch.TextChanged。 单击以获得更多信息:'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup2075"'
	Private Sub txtSearch_TextChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles txtSearch.TextChanged
		
		If Trim(txtSearch.Text) <> "" Then
			cmdSearch.Enabled = True
		Else
			cmdSearch.Enabled = False
		End If
		
	End Sub
	
	Private Sub txtSearch_Enter(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles txtSearch.Enter
		
		txtSearch.SelectionStart = 0
		txtSearch.SelectionLength = Len(txtSearch.Text)
		
	End Sub
	
	Private Sub txtSearch_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles txtSearch.KeyPress
		Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
		
		If KeyAscii = 13 Then
			If cmdSearch.Enabled = True Then
				cmdSearch.Focus()
			End If
		End If
		
		If KeyAscii = 0 Then
			eventArgs.Handled = True
		End If
	End Sub
End Class

⌨️ 快捷键说明

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