📄 form_beiwang.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 Form_Beiwang
Caption = "备忘录"
ClientHeight = 5400
ClientLeft = 60
ClientTop = 435
ClientWidth = 8295
LinkTopic = "Form1"
ScaleHeight = 5400
ScaleWidth = 8295
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
BackColor = &H00FFFFFF&
Height = 4935
Left = 120
TabIndex = 0
Top = 120
Width = 7935
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "Form_BeiWang.frx":0000
Height = 4455
Left = 2880
TabIndex = 9
Top = 240
Width = 4935
_ExtentX = 8705
_ExtentY = 7858
_Version = 393216
AllowUpdate = -1 'True
HeadLines = 1
RowHeight = 15
AllowAddNew = -1 'True
AllowDelete = -1 'True
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
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 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
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin MSAdodcLib.Adodc Adodc_BW
Height = 495
Left = 3840
Top = 2280
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 873
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 3
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "DSN=database"
OLEDBString = ""
OLEDBFile = ""
DataSourceName = "database"
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from BeiWang"
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 Cmd_exit
Caption = "退出"
Height = 375
Left = 1800
TabIndex = 8
Top = 4320
Width = 735
End
Begin VB.CommandButton Cmd_delete
Caption = "删除"
Height = 375
Left = 960
TabIndex = 7
Top = 4320
Width = 735
End
Begin VB.CommandButton Cmd_save
Caption = "添加"
Height = 375
Left = 120
TabIndex = 6
Top = 4320
Width = 735
End
Begin VB.TextBox Text_content
DataSource = "Adodc_BW"
Height = 2655
Left = 720
TabIndex = 5
Top = 1200
Width = 1935
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 375
Left = 720
TabIndex = 4
Top = 600
Width = 1815
_ExtentX = 3201
_ExtentY = 661
_Version = 393216
Format = 25559041
CurrentDate = 39241
End
Begin VB.Line Line3
BorderColor = &H00FF0000&
X1 = 0
X2 = 2760
Y1 = 4080
Y2 = 4080
End
Begin VB.Label Label3
Caption = "内容:"
Height = 255
Left = 120
TabIndex = 3
Top = 1200
Width = 615
End
Begin VB.Label Label2
Caption = "时间:"
Height = 375
Left = 120
TabIndex = 2
Top = 600
Width = 735
End
Begin VB.Line Line2
BorderColor = &H00FF0000&
X1 = 2760
X2 = 2760
Y1 = 120
Y2 = 4800
End
Begin VB.Line Line1
BorderColor = &H00FF0000&
X1 = 0
X2 = 2760
Y1 = 480
Y2 = 480
End
Begin VB.Label Label1
Caption = "请在此填写留言内容:"
Height = 255
Left = 120
TabIndex = 1
Top = 240
Width = 1815
End
End
End
Attribute VB_Name = "Form_Beiwang"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Cmd_save_Click() '添加一个备忘留言记录
Dim sqlstr As String
If Me.Text_content.Text = "" Or Me.DTPicker1.Value = "" Then
MsgBox "不能空白!"
Exit Sub
End If
On Error Resume Next
'添加一个备忘留言记录到数据库
sqlstr = "insert into BeiWang" & "(LYtime,Content)" & _
"values(" & "'" & Me.DTPicker1.Value & "'," & _
"'" & Me.Text_content.Text & "');"
RemoteCnn.Execute sqlstr
MsgBox "添加成功!"
'界面更新
Me.Adodc_BW.Refresh
End Sub
Private Sub Cmd_delete_Click() '删除一个备忘留言记录
'是否选择了记录
If Me.DataGrid1.Row = -1 Then
MsgBox "没有数据"
Exit Sub
End If
'删除选定的记录
Me.Adodc_BW.Recordset.Delete
MsgBox "删除成功"
End Sub
Private Sub Cmd_exit_Click()
Unload Me
End Sub
Private Sub DataGrid1_Click() '选择一个备忘留言记录
'在界面显示选定的记录
Me.DTPicker1.Value = DataGrid1.Columns(1).Text
Me.Text_content.Text = DataGrid1.Columns(2).Text
End Sub
Private Sub Form_Load() '窗体装载
On Error Resume Next
'打开备忘录表并填充表格
Me.Adodc_BW.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=" & _
"False;User ID=" & UID & ";pwd=" & PWD & ";Data Source=" & MyDSN
Adodc_BW.RecordSource = "select LYID as 编号," & _
"LYtime as 时间," & _
"Content as 内容 from BeiWang"
Adodc_BW.Refresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -