📄 form2.frm
字号:
VERSION 5.00
Begin VB.Form Form2
Caption = "回忆"
ClientHeight = 5880
ClientLeft = 2265
ClientTop = 1425
ClientWidth = 7110
Icon = "Form2.frx":0000
LinkTopic = "Form2"
Picture = "Form2.frx":0442
ScaleHeight = 5880
ScaleWidth = 7110
Begin VB.CommandButton Command2
Caption = "添加"
Height = 495
Left = 3600
TabIndex = 4
ToolTipText = "将文本添加到日记后面"
Top = 5040
Width = 735
End
Begin VB.TextBox Text3
BackColor = &H00FFC0FF&
Height = 1455
Left = 240
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 6
Text = "Form2.frx":B90C
Top = 3360
Width = 6615
End
Begin VB.CommandButton Command1
Caption = "关闭"
Height = 495
Left = 5400
TabIndex = 7
ToolTipText = "退出"
Top = 5040
Width = 735
End
Begin VB.TextBox Text1
BackColor = &H00FFC0FF&
Height = 2655
Left = 240
Locked = -1 'True
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 5
Top = 120
Width = 6615
End
Begin VB.CommandButton Command4
Caption = "搜索"
Height = 255
Left = 2640
TabIndex = 3
ToolTipText = "按日期搜索日记"
Top = 3000
Width = 735
End
Begin VB.TextBox Text2
Height = 270
Left = 240
MaxLength = 4
TabIndex = 0
Top = 3000
Width = 615
End
Begin VB.TextBox Text4
Height = 270
Left = 1200
MaxLength = 2
TabIndex = 1
Top = 3000
Width = 375
End
Begin VB.TextBox Text6
Height = 270
Left = 1920
MaxLength = 2
TabIndex = 2
Top = 3000
Width = 375
End
Begin VB.Label Label1
BackColor = &H00FFC0C0&
Caption = "注意:年份一栏所输入的年份有系统区别,例:win98为01-1-1,win2000为2001-1-1"
Height = 375
Left = 3480
TabIndex = 11
Top = 2880
Width = 3375
End
Begin VB.Label Label2
BackColor = &H00FFC0C0&
Caption = " 年"
Height = 255
Left = 840
TabIndex = 10
Top = 3000
Width = 375
End
Begin VB.Label Label3
BackColor = &H00FFC0C0&
Caption = " 月"
Height = 255
Left = 1560
TabIndex = 9
Top = 3000
Width = 375
End
Begin VB.Label Label4
BackColor = &H00FFC0C0&
Caption = " 日"
Height = 255
Left = 2280
TabIndex = 8
Top = 3000
Width = 375
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Command2_Click()
Dim shijian As String
Dim riqi As String
Dim filenum As Integer
Dim FileName As String
Dim name As String
Dim kg As String
Dim hx As String
riqi = Date
shijian = Time()
name = ".txt" 'name = ".dat"
kg = " "
hx = "-"
FileName = Text2.Text + hx + Text4.Text + hx + Text6.Text + name
filenum = FreeFile()
Open FileName For Output As filenum
Text1.Text = Text1.Text + (Chr(13) + Chr(10)) + riqi + kg + shijian + (Chr(13) + Chr(10)) + Text3.Text
Print #filenum, Text1.Text
Close filenum
Form2.Show , Form1
Text1.Text = ""
End Sub
Private Sub Command4_Click()
On Error GoTo Err100
Dim hx As String
Dim filenum As Integer
Dim FileName As String
Dim name As String
Dim buffer1 As String
Dim buffer As String
Dim Maxlen As Long
name = ".txt"
hx = "-"
Maxlen = 32768
FileName = Text2.Text + hx + Text4.Text + hx + Text6.Text + name
filenum = FreeFile()
Open FileName For Input As filenum
Do While Not EOF(filenum) And Len(buffer) < Maxlen
Line Input #filenum, buffer1
buffer = buffer + buffer1 + Chr(13) + Chr(10)
Loop
Close filenum
Text1.Text = buffer
buffer = ""
buffer1 = ""
If FileName = Null Then
Err100:
MsgBox "对不起!这一天你没有写日记啊!" & vbCrLf & vbCrLf & Err.Description, vbInformation
End If
End Sub
Private Sub Form_Load()
End Sub
Private Sub Text2_keyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Text4.SetFocus '13 是return键Tab键与回车键
'文本框在用户按回车键时会发出蜂鸣声,如何避免呢?输 入以下代码
If KeyAscii = 13 Then
KeyAscii = 0
End If
End Sub
Private Sub Text4_keyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Text6.SetFocus '13 是return键Tab键与回车键
'文本框在用户按回车键时会发出蜂鸣声,如何避免呢?输 入以下代码
If KeyAscii = 13 Then
KeyAscii = 0
End If
End Sub
Private Sub Text6_keyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Command4_Click 'Text2.SetFocus '13 是return键Tab键与回车键
'文本框在用户按回车键时会发出蜂鸣声,如何避免呢?输 入以下代码
If KeyAscii = 13 Then
KeyAscii = 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -