📄 form3.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 Form3
BorderStyle = 1 'Fixed Single
Caption = "课程数据"
ClientHeight = 6045
ClientLeft = 45
ClientTop = 435
ClientWidth = 5475
Icon = "Form3.frx":0000
LinkTopic = "Form3"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6045
ScaleWidth = 5475
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Caption = "工具栏"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 6015
Left = 120
TabIndex = 0
Top = 0
Width = 1935
Begin VB.CommandButton Command5
Caption = "显示全部记录"
Height = 495
Left = 240
TabIndex = 7
Top = 4200
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "定位到末记录"
Height = 495
Left = 240
TabIndex = 5
Top = 480
Width = 1455
End
Begin VB.CommandButton Command2
Caption = "删 除 记 录"
Height = 495
Left = 240
TabIndex = 4
Top = 1560
Width = 1455
End
Begin VB.CommandButton Command3
Caption = "查找课程名"
Height = 495
Left = 240
TabIndex = 3
Top = 2640
Width = 1455
End
Begin VB.TextBox Text1
Height = 375
Left = 120
TabIndex = 2
Top = 3360
Width = 1695
End
Begin VB.CommandButton Command4
Caption = "退 出"
Height = 495
Left = 240
TabIndex = 1
Top = 5280
Width = 1455
End
End
Begin MSDataGridLib.DataGrid DataGrid1
Height = 6015
Left = 2160
TabIndex = 6
Top = 0
Width = 3255
_ExtentX = 5741
_ExtentY = 10610
_Version = 393216
AllowUpdate = -1 'True
HeadLines = 1
RowHeight = 17
AllowAddNew = -1 'True
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 11.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 11.25
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
Align = 2 'Align Bottom
Height = 330
Left = 0
Top = 5715
Visible = 0 'False
Width = 5475
_ExtentX = 9657
_ExtentY = 582
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
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveLast
End If
End Sub
Private Sub Command2_Click()
If Not Adodc1.Recordset.EOF And Not Adodc1.Recordset.BOF Then
'On Error Resume Next
a = MsgBox("你确定要删除数据吗?", vbYesNo, "提示")
If a = vbYes Then
Adodc1.Recordset.Delete
DataGrid1.SetFocus
End If
End If
End Sub
Private Sub Command3_Click()
On Error Resume Next
Adodc1.Recordset.Filter = "[kc] like '*" & Trim(Text1.Text) & "*'"
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Command5_Click()
Call connecta
End Sub
Private Sub DataGrid1_HeadClick(ByVal ColIndex As Integer)
If clickflg = False Then
Adodc1.Recordset.Sort = "kc asc"
clickflg = True
Else
Adodc1.Recordset.Sort = "kc desc"
clickflg = False
End If
End Sub
Private Sub Form_Activate()
DataGrid1.SetFocus
End Sub
Private Sub Form_Load()
Form3.Move (Screen.Width - Form3.Width) / 2, (Screen.Height - Form3.Height) / 2
Call connecta
End Sub
Private Sub connecta()
Adodc1.ConnectionString = connstr '"provider=microsoft.jet.oledb.4.0; jet oledb:database password=office;data source=" & App.Path & "\msshuju.ocx"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from kecheng order by kc asc"
Adodc1.Refresh
'Adodc1.Recordset.Sort = "bj"
Set DataGrid1.DataSource = Adodc1
DataGrid1.Columns(0).Caption = "课 程"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -