📄 form4.frm
字号:
VERSION 5.00
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Begin VB.Form Form4
BorderStyle = 3 'Fixed Dialog
Caption = "Form4"
ClientHeight = 2910
ClientLeft = 45
ClientTop = 435
ClientWidth = 6015
ControlBox = 0 'False
LinkTopic = "Form4"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2910
ScaleWidth = 6015
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin MSComDlg.CommonDialog CommonDialog1
Left = 3960
Top = 2400
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton Command3
Caption = "其它"
Height = 495
Left = 1560
TabIndex = 9
Top = 1920
Width = 615
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 840
TabIndex = 8
Top = 1920
Width = 615
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 495
Left = 120
TabIndex = 7
Top = 1920
Width = 615
End
Begin RichTextLib.RichTextBox RichTextBox1
Height = 2295
Left = 2400
TabIndex = 6
Top = 120
Width = 3495
_ExtentX = 6165
_ExtentY = 4048
_Version = 393217
ReadOnly = -1 'True
TextRTF = $"Form4.frx":0000
End
Begin VB.Frame Frame2
Height = 1335
Left = 120
TabIndex = 0
Top = 480
Width = 2175
Begin VB.CommandButton Command8
Caption = "上"
Height = 375
Left = 240
TabIndex = 4
Top = 240
Width = 855
End
Begin VB.CommandButton Command7
Caption = "下"
Height = 375
Left = 1200
TabIndex = 3
Top = 240
Width = 735
End
Begin VB.CommandButton Command10
Caption = "末"
Height = 375
Left = 1200
TabIndex = 2
Top = 720
Width = 735
End
Begin VB.CommandButton Command9
Caption = "首"
Height = 375
Left = 240
TabIndex = 1
Top = 720
Width = 855
End
End
Begin VB.Label Label1
Caption = "Label1"
Height = 255
Left = 720
TabIndex = 5
Top = 120
Width = 1455
End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Conn As New ADODB.Connection
Dim Con As New ADODB.Connection
Dim Connstr As String
Dim Rec As ADODB.Recordset
Dim Re As ADODB.Recordset
Private Sub Command1_Click() '确定
Form2.RichTextBox1(0).Text = RichTextBox1.Text
Form2.Show
Me.Hide
End Sub
Private Sub Command10_Click() '末
Rec.MoveLast
Label1.Caption = "第" & Rec.Fields(0) & "篇"
RichTextBox1.Text = Rec.Fields(1)
check
End Sub
Private Sub Command2_Click()
Form2.Show
Me.Hide
End Sub
Private Sub Command3_Click()
Dim temp As String
CommonDialog1.Filter = "文本文件(*.txt)|*.txt"
CommonDialog1.ShowOpen
RichTextBox1.FileName = CommonDialog1.FileName
Label1.Caption = ""
End Sub
Private Sub Command7_Click() '下一篇
Rec.MoveNext
If Not Rec.EOF Then
Label1.Caption = "第" & Rec.Fields(0) & "篇"
RichTextBox1.Text = Rec.Fields(1)
Else
MsgBox "已到最后一篇记录!"
End If
check
End Sub
Private Sub Command8_Click() '上一篇
Rec.MovePrevious
If Not Rec.BOF Then
Label1.Caption = "第" & Rec.Fields(0) & "篇"
RichTextBox1.Text = Rec.Fields(1)
Else
MsgBox "已到第一篇记录!"
End If
check
End Sub
Private Sub Command9_Click() '第一篇
Rec.MoveFirst
Label1.Caption = "第" & Rec.Fields(0) & "篇"
RichTextBox1.Text = Rec.Fields(1)
check
End Sub
Private Sub Form_Load()
Set Conn = Nothing
Connstr = "dbq=" & App.Path & "\pfsj.mdb" & ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)}"
Conn.Open Connstr
Set Rec = New ADODB.Recordset
Rec.Open "select * from wenzhang", Conn, 1, 3
Rec.MoveFirst
Label1.Caption = "第" & Rec.Fields(0) & "篇"
RichTextBox1.Text = Rec.Fields(1)
End Sub
Sub check()
If Rec.BOF Then
Command8.Enabled = False
Command9.Enabled = False
Else
Command8.Enabled = True
Command9.Enabled = True
End If
If Rec.EOF Then
Command7.Enabled = False
Command10.Enabled = False
Else
Command7.Enabled = True
Command10.Enabled = True
End If
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Rec.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -