📄 frm_jsb.frm
字号:
ImageIndex = 2
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "修改"
Key = "Edit"
ImageIndex = 3
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "保存"
Key = "Save"
ImageIndex = 4
EndProperty
BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "取消"
Key = "Cancel"
ImageIndex = 5
EndProperty
BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "退出"
Key = "Exit"
ImageIndex = 6
EndProperty
BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
EndProperty
BorderStyle = 1
End
Begin VB.Label Label6
Caption = "负责人"
Height = 225
Left = 255
TabIndex = 6
Top = 3225
Width = 705
End
Begin VB.Line Line2
BorderColor = &H00008000&
Index = 1
X1 = 390
X2 = 4425
Y1 = 3030
Y2 = 3030
End
Begin VB.Line Line1
BorderColor = &H00008000&
Index = 1
X1 = 4410
X2 = 375
Y1 = 2985
Y2 = 2985
End
Begin VB.Label Label5
Caption = "内容"
Height = 255
Left = 210
TabIndex = 4
Top = 1395
Width = 435
End
Begin VB.Label Label3
Caption = "日期"
Height = 210
Left = 2790
TabIndex = 2
Top = 3240
Width = 450
End
Begin VB.Label Label2
Caption = "标题"
Height = 225
Left = 210
TabIndex = 0
Top = 900
Width = 570
End
End
Attribute VB_Name = "frm_Jsb"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
Dim c
Dim SNums As Integer
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub DataGrid1_Click()
On Error Resume Next
If Adodc1.Recordset.RecordCount > 0 Then
Text1.Text = Adodc1.Recordset.Fields(1)
DT1.Value = Adodc1.Recordset.Fields(2)
Text2.Text = Adodc1.Recordset.Fields(4)
Text3.Text = Adodc1.Recordset.Fields(3)
End If
End Sub
Private Sub DT1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Call Saves
End If
End Sub
Private Sub Form_Load()
Call LoadFile
Call Tbr_cortrol(Tbr_xxcz, True)
Text3.Text = Name1
Text3.Enabled = False
Adodc1.ConnectionString = PublicStr
Adodc1.RecordSource = "select * from 记事本 order by ID"
Adodc1.Refresh
DT1.Value = Date
End Sub
Private Sub Tbr_xxcz_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case "Add"
Call Tbr_cortrol(Tbr_xxcz, False)
Text1.Text = ""
Text2.Text = ""
AdoRs.Open "select * from 记事本 order by ID ", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
AdoRs.MoveLast
SNums = Val(AdoRs.Fields("ID")) + 1
Else
SNums = 1
End If
AdoRs.Close
Text1.SetFocus
Case "Del" '删除信息
Call Deletes
Case "Edit" '修改信息
Call Edits
Case "Save" '保存信息
Call Saves
Case "Cancel"
Call Tbr_cortrol(Tbr_xxcz, True)
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
Case "Exit"
Unload Me
End Select
End Sub
Private Sub Saves() '保存信息的事件过程
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox "标题或内容不能空值", 48, "提示信息"
Else
AdoRs.Open "select * from 记事本 where 标题='" + Text1.Text + "'", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
MsgBox "该信息已经存在", 48, "提示信息"
AdoRs.Close
Else
AdoRs.Close
c = MsgBox("确认保存信息吗", 33, "提示信息")
If c = vbOK Then
Set AdoRs = Cnn.Execute("insert into 记事本 values('" & SNums _
& "','" & Text1 & "','" & Str(DT1.Value) & "','" & Text3 & "','" & Text2 & "',' ',' ')")
MsgBox "数据保存成功", 64, "提示信息"
Call Refreshs
Else
End If
End If
Call Tbr_cortrol(Tbr_xxcz, True)
End If
End Sub
Private Sub Edits() '修改信息的事件过程
c = MsgBox("确认修改信息吗", 33, "提示信息")
If c = vbOK Then
On Error Resume Next
Set AdoRs = Cnn.Execute("UPDATE 记事本 SET 标题='" + Text1 + "',时间='" + Str(DT1.Value) + "',内容='" + Text2 + "',记录修改日期='" + Str(Date) + "',记录修改人='" + Name1 + "' where ID='" + Adodc1.Recordset.Fields(0) + "'")
MsgBox "数据修改成功", 64, "提示信息"
StrId = Text1.Text
StrTitle = Text3.Text
Call joinRZ
Call Refreshs
Else
End If
End Sub
Private Sub LoadFile()
On Error Resume Next
AdoRs.Open "select * from 记事本", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
Text1.Text = AdoRs.Fields("标题")
DT1.Value = AdoRs.Fields("日期")
Text2.Text = AdoRs.Fields("内容")
Text3.Text = AdoRs.Fields("负责人")
End If
AdoRs.Close
End Sub
Private Sub Deletes() '删除信息
c = MsgBox("确认删除该信息吗", 17, "提示信息")
If c = vbOK Then
Set AdoRs = Cnn.Execute("Delete 记事本 from 记事本 where 标题='" + Text1.Text + "'")
End If
Text1.Text = ""
Text2.Text = ""
Call Refreshs
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
DT1.SetFocus
End If
End Sub
Private Sub Refreshs()
Adodc1.RecordSource = "select * from 记事本 order by ID"
Adodc1.Refresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -