📄 form1.frm
字号:
VERSION 5.00
Object = "{00028C01-0000-0000-0000-000000000046}#1.0#0"; "DBGRID32.OCX"
Begin VB.Form form1
BorderStyle = 0 'None
Caption = "查询"
ClientHeight = 4920
ClientLeft = 4635
ClientTop = 2910
ClientWidth = 5985
LinkTopic = "Form1"
Picture = "Form1.frx":0000
ScaleHeight = 4920
ScaleWidth = 5985
ShowInTaskbar = 0 'False
Begin VB.CommandButton Command6
Caption = "刷 新"
Height = 375
Left = 480
Picture = "Form1.frx":6C6C
Style = 1 'Graphical
TabIndex = 10
Top = 3600
Width = 855
End
Begin MSDBGrid.DBGrid DBGrid1
Bindings = "Form1.frx":1126E
Height = 1935
Left = 720
OleObjectBlob = "Form1.frx":11282
TabIndex = 9
Top = 840
Width = 4335
End
Begin VB.CommandButton Command4
Caption = "结束查询"
Height = 375
Left = 3000
Picture = "Form1.frx":11C45
Style = 1 'Graphical
TabIndex = 8
Top = 3600
Width = 855
End
Begin VB.CommandButton Command2
Caption = "启始查询"
Height = 375
Left = 2160
Picture = "Form1.frx":1C247
Style = 1 'Graphical
TabIndex = 7
Top = 3600
Width = 855
End
Begin VB.CommandButton Command1
Caption = "精确查询"
Height = 375
Left = 3840
Picture = "Form1.frx":26849
Style = 1 'Graphical
TabIndex = 6
Top = 3600
Width = 855
End
Begin VB.CommandButton Command5
Caption = "返回"
Height = 375
Left = 4680
Picture = "Form1.frx":30E4B
Style = 1 'Graphical
TabIndex = 3
Top = 3600
Width = 855
End
Begin VB.CommandButton Command3
Caption = "模糊查询"
Height = 375
Left = 1320
Picture = "Form1.frx":3B44D
Style = 1 'Graphical
TabIndex = 2
Top = 3600
Width = 855
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 3480
TabIndex = 1
Top = 3000
Width = 1455
End
Begin VB.ComboBox Combo1
DataSource = "Data1"
Height = 300
Left = 1200
TabIndex = 0
Text = "请选择"
Top = 3000
Width = 975
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 345
Left = 2640
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "College_Grade4"
Top = 4320
Visible = 0 'False
Width = 1620
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "查找信息"
ForeColor = &H0000FFFF&
Height = 255
Left = 2520
TabIndex = 5
Top = 3120
Width = 735
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "类别"
ForeColor = &H0000FFFF&
Height = 255
Left = 720
TabIndex = 4
Top = 3120
Width = 495
End
End
Attribute VB_Name = "form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function SetWindowRgn Lib "user32" _
( _
ByVal hWnd As Long, ByVal hRgn As Long, _
ByVal bRedraw As Boolean _
) As Long
'声明设置窗口形状的API函数
Private Declare Function ReleaseCapture Lib "user32" _
( _
) As Long
Private Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" _
( _
ByVal hWnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any _
) As Long
Private Const WM_SYSCOMMAND = &H112
Private Const SC_MOVE = &HF010&
Private Const HTCAPTION = 2
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, _
X As Single, Y As Single)
If Button = 1 Then
'如果按下鼠标左键
Dim ReturnVal As Long
X = ReleaseCapture()
ReturnVal = SendMessage(form1.hWnd, WM_SYSCOMMAND, _
SC_MOVE + HTCAPTION, 0)
End If
End Sub
Private Sub Command1_Click()
Me.MousePointer = 11
strRun = LTrim$(RTrim$(Combo1.Text))
Select Case strRun
Case Combo1.List(0):
Data1.RecordSource = "select * from College_Grade4 where 单词= '" + Text1.Text + "'"
Data1.Refresh
Case Combo1.List(1): ' like" + Chr(34) + Text1.Text + "*" + Chr(34) + "" ='" + Text1.Text + "'"
Data1.RecordSource = "select * from College_Grade4 where 解释 = '" + Text1.Text + "'"
Data1.Refresh
End Select
If Data1.Recordset.RecordCount = 0 Then
MsgBox "数据库内未发现此条目"
End If
End Sub
Private Sub Command2_Click()
Me.MousePointer = 11
strRun = LTrim$(RTrim$(Combo1.Text))
Select Case strRun
Case Combo1.List(0):
Data1.RecordSource = "select * from College_Grade4 where 单词 like '" + Text1.Text + "*" + "'"
Data1.Refresh
Case Combo1.List(1): ' like" + Chr(34) + Text1.Text + "*" + Chr(34) + "" ='" + Text1.Text + "'"
Data1.RecordSource = "select * from College_Grade4 where 解释 like '" + Text1.Text + "*" + "'"
Data1.Refresh
End Select
If Data1.Recordset.RecordCount = 0 Then
MsgBox "数据库内未发现此条目"
End If
End Sub
Private Sub Command3_Click()
Me.MousePointer = 11
strRun = LTrim$(RTrim$(Combo1.Text))
Select Case strRun
Case Combo1.List(0):
Data1.RecordSource = "select * from College_Grade4 where 单词 like '" + "*" + Text1.Text + "*" + "'"
Data1.Refresh
Case Combo1.List(1): ' like" + Chr(34) + Text1.Text + "*" + Chr(34) + "" ='" + Text1.Text + "'"
Data1.RecordSource = "select * from College_Grade4 where 解释 like '" + "*" + Text1.Text + "*" + "'"
Data1.Refresh
End Select
If Data1.Recordset.RecordCount = 0 Then
MsgBox "数据库内未发现此条目"
End If
End Sub
Private Sub Command4_Click()
Me.MousePointer = 11
strRun = LTrim$(RTrim$(Combo1.Text))
Select Case strRun
Case Combo1.List(0):
Data1.RecordSource = "select * from College_Grade4 where 单词 like '" + "*" + Text1.Text + "'"
Data1.Refresh
Case Combo1.List(1): ' like" + Chr(34) + Text1.Text + "*" + Chr(34) + "" ='" + Text1.Text + "'"
Data1.RecordSource = "select * from College_Grade4 where 解释 like '" + "*" + Text1.Text + "'"
Data1.Refresh
End Select
If Data1.Recordset.RecordCount = 0 Then
MsgBox "数据库内未发现此条目"
End If
End Sub
Private Sub Command5_Click()
form1.Hide
End Sub
Private Sub Command6_Click()
Data1.Refresh
End Sub
Private Sub Command7_Click()
Data1.RecordSource = "select * from College_Grade4 order by 单词 asc;"
Data1.Refresh
End Sub
Private Sub Form_Load()
Combo1.AddItem "英文单词"
Combo1.AddItem "中文解释"
Data1.DatabaseName = App.Path & "\" & "Word" & "\" & "data.mdb"
chaxun form1
End Sub
Private Sub MSFlexGrid2_Click()
End Sub
'Private Sub Form_Paint()
' Dim wid As Single
' Dim hgt As Single
' Dim x As Single
' Dim y As Single
' wid = Me.ScaleWidth
' hgt = Me.ScaleHeight
' y = 0
' Do While y < ScaleHeight
' x = 0
' Do While x < ScaleWidth
' PaintPicture Me.Picture, x, y, wid, hgt
' x = x + wid
' Loop
' y = y + hgt
' Loop
'End Sub
Private Sub Image1_Click()
Me.MousePointer = 11
strRun = LTrim$(RTrim$(Combo1.Text))
Select Case strRun
Case Combo1.List(0):
Data1.RecordSource = "select * from College_Grade4 where 单词= '" + Text1.Text + "'"
Data1.Refresh
Case Combo1.List(1): ' like" + Chr(34) + Text1.Text + "*" + Chr(34) + "" ='" + Text1.Text + "'"
Data1.RecordSource = "select * from College_Grade4 where 解释 = '" + Text1.Text + "'"
Data1.Refresh
End Select
End Sub
Private Sub Image2_Click()
Me.MousePointer = 11
strRun = LTrim$(RTrim$(Combo1.Text))
Select Case strRun
Case Combo1.List(0):
Data1.RecordSource = "select * from College_Grade4 where 单词 like '" + "*" + Text1.Text + "*" + "'"
Data1.Refresh
Case Combo1.List(1): ' like" + Chr(34) + Text1.Text + "*" + Chr(34) + "" ='" + Text1.Text + "'"
Data1.RecordSource = "select * from College_Grade4 where 解释 like '" + "*" + Text1.Text + "*" + "'"
Data1.Refresh
End Select
End Sub
Private Sub Image3_Click()
Me.MousePointer = 11
strRun = LTrim$(RTrim$(Combo1.Text))
Select Case strRun
Case Combo1.List(0):
Data1.RecordSource = "select * from College_Grade4 where 单词 like '" + Text1.Text + "*" + "'"
Data1.Refresh
Case Combo1.List(1): ' like" + Chr(34) + Text1.Text + "*" + Chr(34) + "" ='" + Text1.Text + "'"
Data1.RecordSource = "select * from College_Grade4 where 解释 like '" + Text1.Text + "*" + "'"
Data1.Refresh
End Select
End Sub
Private Sub Image4_Click()
Me.MousePointer = 11
strRun = LTrim$(RTrim$(Combo1.Text))
Select Case strRun
Case Combo1.List(0):
Data1.RecordSource = "select * from College_Grade4 where 单词 like '" + Text1.Text + "*" + "'"
Data1.Refresh
Case Combo1.List(1): ' like" + Chr(34) + Text1.Text + "*" + Chr(34) + "" ='" + Text1.Text + "'"
Data1.RecordSource = "select * from College_Grade4 where 解释 like '" + Text1.Text + "*" + "'"
Data1.Refresh
End Select
End Sub
Private Sub Image5_Click()
form1.Hide
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -