📄 main_fzgj_memo.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form main_fzgj_memo
BorderStyle = 1 'Fixed Single
Caption = "备忘录"
ClientHeight = 2910
ClientLeft = 3915
ClientTop = 3540
ClientWidth = 9360
ControlBox = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2910
ScaleWidth = 9360
Begin VB.Frame Frame1
Caption = "备忘"
Height = 2790
Left = 75
TabIndex = 0
Top = 60
Width = 9210
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 525
Top = 1575
Visible = 0 'False
Width = 1635
_ExtentX = 2884
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.CommandButton cmdEnd
Caption = "退出(&E)"
Height = 345
Left = 7980
TabIndex = 11
Top = 255
Width = 1155
End
Begin VB.CommandButton cmdClearMemo
Caption = "清除备忘(&D)"
Height = 345
Left = 6840
TabIndex = 7
Top = 255
Width = 1155
End
Begin VB.CommandButton cmdSave
Caption = "保存(&S)"
Height = 345
Left = 5700
TabIndex = 6
Top = 255
Width = 1155
End
Begin VB.CommandButton cmdMemo
Caption = "备忘(&M)"
Height = 345
Left = 4560
TabIndex = 5
Top = 255
Width = 1155
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 300
Left = 915
TabIndex = 4
Top = 300
Width = 1275
_ExtentX = 2249
_ExtentY = 529
_Version = 393216
Format = 190316545
CurrentDate = 38616
End
Begin VB.TextBox Text1
Height = 1965
Left = 915
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 3
Top = 735
Width = 8190
End
Begin MSComCtl2.DTPicker DTPicker2
Height = 300
Left = 3165
TabIndex = 12
Top = 285
Width = 1275
_ExtentX = 2249
_ExtentY = 529
_Version = 393216
Format = 190316545
CurrentDate = 38616
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "提醒日期:"
Height = 180
Left = 2265
TabIndex = 13
Top = 345
Width = 900
End
Begin VB.Label Label2
Caption = "备忘日期:"
Height = 180
Left = 45
TabIndex = 2
Top = 345
Width = 900
End
Begin VB.Label Label1
Caption = "备忘内容:"
Height = 180
Left = 60
TabIndex = 1
Top = 780
Width = 900
End
End
Begin VB.Frame Frame3
Caption = "双击数据行删除备忘记录"
Height = 2790
Left = 75
TabIndex = 8
Top = 60
Width = 9210
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "main_fzgj_memo.frx":0000
Height = 2190
Left = 60
TabIndex = 9
Top = 510
Width = 9060
_ExtentX = 15981
_ExtentY = 3863
_Version = 393216
AllowUpdate = 0 'False
BackColor = -2147483624
HeadLines = 1
RowHeight = 16
FormatLocked = -1 'True
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 4
BeginProperty Column00
DataField = "ID"
Caption = "ID"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = "日期"
Caption = "日期"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column02
DataField = "备忘内容"
Caption = "备忘内容"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column03
DataField = "提醒日期"
Caption = "提醒日期"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
MarqueeStyle = 4
BeginProperty Column00
ColumnWidth = 404.787
EndProperty
BeginProperty Column01
ColumnWidth = 840.189
EndProperty
BeginProperty Column02
ColumnWidth = 6180.095
EndProperty
BeginProperty Column03
ColumnWidth = 1005.165
EndProperty
EndProperty
End
Begin VB.CommandButton cmdReturn
Caption = "返回"
Height = 300
Left = 8130
TabIndex = 10
Top = 165
Width = 975
End
End
End
Attribute VB_Name = "main_fzgj_memo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdClearMemo_Click()
Sql = "select * from 备忘录"
Call FunAdo(Adodc1, Sql)
Adodc1.Refresh
If Adodc1.Recordset.RecordCount <= 0 Then
MsgBox "数据表中已经没有记录可删除! ", vbOKOnly + vbInformation, "提示"
Frame3.Visible = False
Exit Sub
ElseIf Adodc1.Recordset.RecordCount > 0 Then
Frame3.Visible = True
Frame3.ZOrder 0
End If
End Sub
Private Sub cmdEnd_Click()
Unload Me
End Sub
Private Sub cmdMemo_Click()
Text1.text = ""
DTPicker1.Enabled = True
DTPicker2.Enabled = True
Text1.Enabled = True
cmdSave.Enabled = True
cmdMemo.Enabled = False
Text1.SetFocus
End Sub
Private Sub cmdReturn_Click()
Frame3.Visible = False
End Sub
Private Sub cmdsave_Click()
If Text1.text = "" Then
If MsgBox("请输入备忘内容", vbOKCancel + vbInformation, "提示") = vbOK Then
Text1.SetFocus
Exit Sub
Else
cmdMemo.Enabled = True
cmdSave.Enabled = False
Text1.Enabled = False
Exit Sub
End If
End If
Dim strDate
Adodc1.Recordset.AddNew '开辟存储空间,添加数据
Adodc1.Recordset.Fields(1).Value = Format(DTPicker1.Value, "yyyy-mm-dd")
'使用Format函数将系统当前日期格式为长日期格式
'关于Format函数的详细说明或实例参见《Visual Basic编程词典》软件函数应用部分,该部分对所有函数都有详细语法说明和最实用的应用实例。
Adodc1.Recordset.Fields(2).Value = Text1.text
Adodc1.Recordset.Fields(3).Value = Format(DTPicker2.Value, "yyyy-mm-dd")
Adodc1.Recordset.Update '保存数据
Adodc1.Refresh
MsgBox "备忘成功! ", vbOKOnly + vbQuestion, "提示"
cmdSave.Enabled = False
cmdMemo.Enabled = True
DTPicker1.Enabled = True
DTPicker2.Enabled = True
Text1.Enabled = True
Text1.text = ""
End Sub
Private Sub DataGrid1_DblClick()
On Error Resume Next
If DataGrid1.Columns(0).text = "" Then Frame3.Visible = False: Exit Sub
If MsgBox("是否删除 ID 为" & DataGrid1.Columns(0).text & " 备忘记录? ", vbOKCancel + vbInformation, "提示") = vbOK Then
Adodc1.Recordset.Delete '删除指定的数据
End If
End Sub
Private Sub Form_Load()
Sql = "select * from 备忘录"
Call FunAdo(Adodc1, Sql)
Adodc1.Refresh
DTPicker1.Enabled = False
DTPicker2.Enabled = False
Text1.Enabled = False
cmdSave.Enabled = False
Frame3.Visible = False
DTPicker1.Value = Format(Date, "yyyy-mm-dd")
DTPicker2.Value = Format(Date, "yyyy-mm-dd") '使用Format函数将系统当前日期格式为长日期格式,Date函数返回系统当前日期
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -