📄 sentense.frm
字号:
VERSION 5.00
Begin VB.Form sentense
Caption = "例句学习"
ClientHeight = 5535
ClientLeft = 60
ClientTop = 345
ClientWidth = 6555
LinkTopic = "Form2"
ScaleHeight = 5535
ScaleWidth = 6555
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command7
Caption = "返回"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2760
TabIndex = 12
Top = 4920
Width = 1455
End
Begin VB.CommandButton Command2
Caption = "查询"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 5160
TabIndex = 7
Top = 120
Width = 1095
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1680
TabIndex = 6
Top = 240
Width = 3015
End
Begin VB.CommandButton Command6
Caption = "删除此例句"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4560
TabIndex = 4
Top = 4200
Width = 1335
End
Begin VB.CommandButton Command5
Caption = "编辑此例句"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2760
TabIndex = 3
Top = 4200
Width = 1455
End
Begin VB.CommandButton Command4
Caption = "添加新例句"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 960
TabIndex = 2
Top = 4200
Width = 1335
End
Begin VB.CommandButton Command3
Caption = "下一句"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4560
TabIndex = 1
Top = 3360
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "上一句"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 960
TabIndex = 0
Top = 3360
Width = 1335
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "英文:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 600
TabIndex = 11
Top = 2040
Width = 525
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "中文:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 600
TabIndex = 10
Top = 960
Width = 525
End
Begin VB.Label Label3
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 360
TabIndex = 9
Top = 2400
Width = 6015
End
Begin VB.Label Label2
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 8
Top = 1440
Width = 5895
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "关键词"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 480
TabIndex = 5
Top = 360
Width = 630
End
End
Attribute VB_Name = "sentense"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim db As DAO.Database
Dim rec As DAO.Recordset
Dim rec1 As DAO.Recordset
Dim rec2 As DAO.Recordset
Private Sub Command1_Click()
Set rec2 = db.OpenRecordset("select * from sentense")
If Not (rec2.BOF And rec2.EOF) Then
rec2.MovePrevious
If rec2.BOF Then
rec2.MoveFirst
End If
Set rec = db.OpenRecordset("select * from sentense where id=" & rec2!id)
Text1.Text = rec!id
Label3.Caption = rec!句子
Label2.Caption = rec!翻译
End If
End Sub
Private Sub Command2_Click()
Dim temp
Dim i As Integer
Dim keyword As String
Dim strsql As String
keyword = Trim(Text1.Text)
strsql = "select * from sentense where keyword='" & keyword & "'"
Set rec1 = db.OpenRecordset(strsql)
If Not rec1.EOF Then
Label2.Caption = rec1!翻译
Label3.Caption = rec1!句子
Else
MsgBox "查询不到所需的例句", vbOKOnly, "系统提示"
End If
End Sub
Private Sub Command3_Click()
Set rec2 = db.OpenRecordset("select * from sentense")
If Not (rec2.BOF And rec2.EOF) Then
rec2.MoveNext
If rec2.BOF Then
rec2.MoveLast
End If
Set rec = db.OpenRecordset("select * from sentense where id=" & rec2!id)
Text1.Text = rec!keyword
Label3.Caption = rec!句子
Label2.Caption = rec!翻译
End If
End Sub
Private Sub Command4_Click()
sentense_in.Show
End Sub
Private Sub Command5_Click()
If Text1.Text <> "" Then
Set rec = db.OpenRecordset("select * from sentense where keyword='" & Text1.Text & "'")
sentense_in.Text1.Text = rec!句子
sentense_in.Text2.Text = rec!翻译
sentense_in.Text3.Text = rec!keyword
sentense_in.Caption = "例句修改"
sentense_in.Show
Else
MsgBox "请输入关键词查询!", vbOKOnly, "系统提示"
End If
End Sub
Private Sub Command6_Click()
Set rec = db.OpenRecordset("select * from sentense where keyword='" & Text1.Text & "'")
If MsgBox("确定要删除吗?", vbYesNo) = vbYes Then
Set rec1 = db.OpenRecordset("select * from sentense where id=" & rec!id & "")
rec1.Delete
End If
End Sub
Private Sub Command7_Click()
Unload Me
End Sub
Private Sub Form_Load()
Set db = OpenDatabase(App.Path & "\sourse.mdb")
Set rec2 = db.OpenRecordset("select * from sentense")
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -