📄 datagrid.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"
Begin VB.Form Form1
Caption = "通信录"
ClientHeight = 5220
ClientLeft = 60
ClientTop = 345
ClientWidth = 7125
LinkTopic = "Form1"
ScaleHeight = 5220
ScaleWidth = 7125
StartUpPosition = 3 '窗口缺省
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "DataGrid.frx":0000
Height = 4335
Left = 120
TabIndex = 0
Top = 120
Width = 6915
_ExtentX = 12197
_ExtentY = 7646
_Version = 393216
AllowUpdate = 0 'False
AllowArrows = -1 'True
BackColor = -2147483639
DefColWidth = 53
Enabled = -1 'True
ColumnHeaders = -1 'True
ForeColor = -2147483635
HeadLines = 2
RowHeight = 14
TabAction = 1
RowDividerStyle = 1
FormatLocked = -1 'True
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "华文新魏"
Size = 9.75
Charset = 134
Weight = 700
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 = 7
BeginProperty Column00
DataField = "ID"
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
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
BeginProperty Column04
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 Column05
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 Column06
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
Size = 2
BeginProperty Column00
WrapText = -1 'True
ColumnWidth = 494.929
EndProperty
BeginProperty Column01
WrapText = -1 'True
ColumnWidth = 900.284
EndProperty
BeginProperty Column02
ColumnWidth = 900.284
EndProperty
BeginProperty Column03
ColumnWidth = 1500.095
EndProperty
BeginProperty Column04
ColumnWidth = 900.284
EndProperty
BeginProperty Column05
ColumnWidth = 900.284
EndProperty
BeginProperty Column06
Locked = -1 'True
ColumnWidth = 1500.095
EndProperty
EndProperty
End
Begin VB.CommandButton Command2
Caption = "退出程序"
Height = 375
Left = 5160
TabIndex = 2
Top = 4680
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "修改记录"
Height = 375
Left = 720
TabIndex = 1
Top = 4680
Width = 1215
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 2520
Top = 4680
Visible = 0 'False
Width = 2280
_ExtentX = 4022
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = $"DataGrid.frx":0015
OLEDBString = $"DataGrid.frx":00A6
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
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
' 控制修改数据
Private Sub Command1_Click()
Select Case Command1.Caption
Case "修改数据"
' 设置用户可以添加、删除和更新数据
DataGrid1.AllowAddNew = True
DataGrid1.AllowDelete = True
DataGrid1.AllowUpdate = True
Command1.Caption = "停止修改"
Case "停止修改"
' 不允许用户修改数据
DataGrid1.AllowAddNew = False
DataGrid1.AllowDelete = False
DataGrid1.AllowUpdate = False
Command1.Caption = "修改数据"
End Select
End Sub
' 退出程序
Private Sub Command2_Click()
End
End Sub
' 确定要删除一条记录
Private Sub DataGrid1_BeforeDelete(Cancel As Integer)
If MsgBox("将要删除该条记录,确认吗?", vbYesNo, "确认") = vbNo Then
Cancel = True '取消插入
End If
End Sub
' 确定要加入一条新的记录
Private Sub DataGrid1_BeforeInsert(Cancel As Integer)
If MsgBox("将要增加一条记录,确认吗?", vbYesNo, "确认") = vbNo Then
Cancel = True '取消插入
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -