📄 frmhistory.frm
字号:
VERSION 5.00
Begin VB.Form frmHistory
Caption = "历史记录"
ClientHeight = 4230
ClientLeft = 60
ClientTop = 345
ClientWidth = 6120
LinkTopic = "Form1"
ScaleHeight = 4230
ScaleWidth = 6120
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox txtLocation
Appearance = 0 'Flat
Height = 330
Left = 45
Locked = -1 'True
TabIndex = 4
Text = "txtLocation"
Top = 3300
Width = 5865
End
Begin VB.CommandButton cmdReturn
Caption = "返 回"
Height = 360
Left = 4455
TabIndex = 3
Top = 3780
Width = 1440
End
Begin VB.TextBox txtMaxNum
Appearance = 0 'Flat
Height = 330
Left = 2820
TabIndex = 2
Text = "txtMaxNum"
Top = 3810
Width = 1275
End
Begin VB.ListBox lstSub
Appearance = 0 'Flat
Height = 2550
Left = 45
TabIndex = 0
Top = 360
Width = 5880
End
Begin VB.Label Label3
Caption = "主题描述:"
Height = 210
Left = 135
TabIndex = 6
Top = 60
Width = 1215
End
Begin VB.Label Label2
Caption = "地址:"
Height = 255
Left = 75
TabIndex = 5
Top = 2970
Width = 1815
End
Begin VB.Label Label1
Caption = "设置历史记录的最大个数:"
Height = 300
Left = 165
TabIndex = 1
Top = 3885
Width = 2400
End
End
Attribute VB_Name = "frmHistory"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim hisDB As Database
Private Sub cmdReturn_Click()
Unload Me
End Sub
Private Sub Form_Load()
'打开浏览网址的历史记录的数据库中相应的表,将历史记录添加到
'ListBox中
Set hisDB = DBEngine.OpenDatabase(App.Path & "\" & "faveLocation.mdb")
Dim tempRec
Set tempRec = hisDB.OpenRecordset("history", dbOpenDynaset)
tempRec.MoveFirst
Do Until tempRec.EOF
txtLocation.Text = tempRec!hisLocation
lstSub.AddItem tempRec!hisSub, 0
tempRec.MoveNext
Loop
tempRec.Close
'从注册表中取得设置的历史记录的最大个数
txtMaxNum.Text = GetSetting(App.Title, "history", "maxnumber", "50")
End Sub
Private Sub Form_Unload(Cancel As Integer)
'检验设置的历史记录的最大个数是否>0
If Val(txtMaxNum.Text) < 0 Then
MsgBox "历史记录的最大个数必须大于零", vbCritical
Cancel = True
Exit Sub
End If
'将设置的最大历史记录的个数存在注册表中
SaveSetting App.Title, "history", "maxnumber", txtMaxNum.Text
frmBrowser.cboAddress.Text = txtLocation.Text
End Sub
Private Sub lstSub_Click()
'从ListBox选择相应的历史记录的标题,根据其标题从数据库中查找相应的记录
Dim tempRec
Dim strSql As String
strSql = "select * from history where hisSub=" & "'" & lstSub.List(lstSub.ListIndex) & "'"
Set tempRec = hisDB.OpenRecordset(strSql, dbOpenSnapshot)
tempRec.MoveFirst
txtLocation.Text = tempRec!hisLocation
tempRec.Close
End Sub
Private Sub lstSub_DblClick()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -