📄 form1.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 = "Form1"
ClientHeight = 7935
ClientLeft = 60
ClientTop = 450
ClientWidth = 10410
LinkTopic = "Form1"
ScaleHeight = 11010
ScaleWidth = 15240
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton cmdmove
Caption = "movelast"
Height = 615
Index = 3
Left = 9120
TabIndex = 7
Top = 1200
Width = 1215
End
Begin VB.CommandButton cmdmove
Caption = "movenext"
Height = 615
Index = 2
Left = 7680
TabIndex = 6
Top = 1200
Width = 1215
End
Begin VB.CommandButton cmdmove
Caption = "moveprevious"
Height = 615
Index = 1
Left = 6240
TabIndex = 5
Top = 1200
Width = 1215
End
Begin MSDataGridLib.DataGrid DataGrid1
Height = 5655
Left = 120
TabIndex = 4
Top = 2040
Width = 8775
_ExtentX = 15478
_ExtentY = 9975
_Version = 393216
HeadLines = 1
RowHeight = 15
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 Adodc1
Height = 495
Left = 0
Top = 360
Width = 8040
_ExtentX = 14182
_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= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = $"Form1.frx":0000
OLEDBString = $"Form1.frx":00A0
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select name from student where name=3"
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.TextBox txt
Height = 495
Index = 2
Left = 2880
TabIndex = 2
Top = 1320
Width = 1215
End
Begin VB.TextBox txt
Height = 495
Index = 1
Left = 1440
TabIndex = 1
Top = 1320
Width = 1215
End
Begin VB.TextBox txt
Height = 495
Index = 0
Left = 0
TabIndex = 0
Top = 1320
Width = 1215
End
Begin VB.CommandButton cmdmove
Caption = "movefirst"
Height = 615
Index = 0
Left = 4680
TabIndex = 3
Top = 1200
Width = 1335
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private mclsstudent As Cstudent
'(3) 定义Command 按钮的Click 事件
Private Sub cmdMove_Click(Index As Integer)
mclsstudent.SaveRecord
Select Case Index
Case 0
mclsstudent.Move FirstRecord
Case 1
mclsstudent.Move PreviousRecord
Case 2
mclsstudent.Move NextRecord
Case 3
mclsstudent.Move LastRecord
End Select
GetData
End Sub
'(1) 在Form Load () 中添加如下代码
Private Sub Form_Load()
Set mclsstudent = New Cstudent '创建类实例
GetData
End Sub
'(2) 定义GetData 方法
Private Sub GetData()
txt(0).Text = mclsstudent.Name '读属性值到控件
txt(1).Text = mclsstudent.Sex '读属性值到控件
txt(2).Text = mclsstudent.Age '读属性值到控件
End Sub
'(4) 在From UnLoad() 中添加如下代码
Private Sub Form_Unload(Cancel As Integer)
mclsstudent.SaveRecord
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -