?? modclass.frm
字號:
VERSION 5.00
Begin VB.Form modclass
Caption = "修改班級"
ClientHeight = 3960
ClientLeft = 60
ClientTop = 345
ClientWidth = 8730
Icon = "modclass.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MDIChild = -1 'True
ScaleHeight = 3960
ScaleWidth = 8730
Begin VB.TextBox Text1
Height = 495
Index = 3
Left = 4320
TabIndex = 14
Top = 1440
Width = 1935
End
Begin VB.TextBox Text1
Height = 495
Index = 2
Left = 4320
TabIndex = 13
Top = 720
Width = 1935
End
Begin VB.TextBox Text1
Height = 495
Index = 1
Left = 1560
TabIndex = 12
Top = 1440
Width = 1935
End
Begin VB.CommandButton Command10
Caption = "關閉(&C)"
Height = 495
Left = 6960
TabIndex = 11
Top = 2880
Width = 1215
End
Begin VB.CommandButton Command9
Caption = "取消(&E)"
Height = 495
Left = 6960
TabIndex = 10
Top = 2400
Width = 1215
End
Begin VB.CommandButton Command8
Caption = "查詢(&Q)"
Height = 495
Left = 6960
TabIndex = 9
Top = 1920
Width = 1215
End
Begin VB.CommandButton Command7
Caption = "更新(&R)"
Height = 495
Left = 6960
TabIndex = 8
Top = 1440
Width = 1215
End
Begin VB.CommandButton Command6
Caption = "刪除(&D)"
Height = 495
Left = 6960
TabIndex = 7
Top = 960
Width = 1215
End
Begin VB.CommandButton Command5
Caption = "編輯(&M)"
Height = 495
Left = 6960
TabIndex = 6
Top = 480
Width = 1215
End
Begin VB.Frame Frame2
Height = 3255
Left = 6840
TabIndex = 5
Top = 240
Width = 1455
End
Begin VB.Frame Frame1
Height = 855
Left = 480
TabIndex = 0
Top = 2640
Width = 6135
Begin VB.CommandButton Command4
Caption = "最后一條記錄"
Height = 495
Left = 4320
TabIndex = 4
Top = 240
Width = 1455
End
Begin VB.CommandButton Command3
Caption = "上一條記錄"
Height = 495
Left = 2880
TabIndex = 3
Top = 240
Width = 1455
End
Begin VB.CommandButton Command2
Caption = "下一條記錄"
Height = 495
Left = 1560
TabIndex = 2
Top = 240
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "第一條記錄"
Height = 495
Left = 240
TabIndex = 1
Top = 240
Width = 1335
End
End
End
Attribute VB_Name = "modclass"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mybookmark As Variant
Private Sub Command1_Click()
Command3.Enabled = True
dream.MoveFirst '移動到數據集的第一條記錄
Call viewdata '調用顯示數據的函數
MsgBox "這是條一條記錄!", 48, "注意!"
End Sub
Private Sub Command2_Click()
Command3.Enabled = True
dream.MoveNext '數據集向后移動一條記錄
If dream.EOF Then '判斷是否終止位置
dream.MoveFirst
End If
Call viewdata
End Sub
Private Sub Command3_Click()
Command2.Enabled = True
dream.MovePrevious '數據集向前移動一條記錄
If dream.BOF Then '判斷是否到起始位置
dream.MoveLast
End If
Call viewdata
End Sub
Private Sub Command4_Click()
Command2.Enabled = False
dream.MoveLast '移動到數據集的最后一條記錄
Call viewdata
MsgBox "這是最后一條記錄!", 48, "注意!"
End Sub
Private Sub Command10_Click()
Unload Me
studentmdi.StatusBar1.Panels.Item(1).Text = " "
End Sub
Private Sub Command5_Click()
If Command5.Caption = "編輯(&M)" Then
Text1(0).Enabled = True
Text1(1).Enabled = True
Text1(2).Enabled = True
Text1(3).Enabled = True
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
mybookmark = dream.Bookmark '記下當前記錄位置
End If
End Sub
Private Sub Command6_Click()
mybookmark = dream.Bookmark
str2$ = MsgBox("是否刪除當前記錄?", vbOKCancel, "刪除當前記錄")
If str2$ = vbOK Then
dream.MoveNext
If dream.EOF Then 'recordset is empty?
dream.MoveFirst
mybookmark = dream.Bookmark 'sign current position
dream.MoveLast
dream.Delete
dream.Close
txtSQL = "select * from class"
Set dream = ExecuteSQL(txtSQL, Msgtext)
dream.MoveLast
Call viewdata
Else
mybookmark = dream.Bookmark 'sign current position
dream.MovePrevious
dream.Delete
dream.Close
txtSQL = "select * from class"
Set dream = ExecuteSQL(txtSQL, Msgtext)
dream.MoveLast
Call viewdata
End If
Else
dream.Bookmark = mybookmark 'return primary position
Call viewdata
End If
End Sub
Private Sub Command7_Click()
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
If dream.EOF = False Then
MsgBox "真的要更新嗎?", vbOKCancel + vbExclamation, "警告"
'record current position
dream.Bookmark = mybookmark 'return to current modifty position
dream.Delete
txtSQL = "select * from class "
Set dream = ExecuteSQL(txtSQL, Msgtext)
dream.Bookmark = mybookmark 'return to current modifty position
dream.AddNew
dream.Fields(0) = Trim(Text1(0).Text)
dream.Fields(1) = Trim(Text1(1).Text)
dream.Fields(2) = Trim(Text1(2).Text)
dream.Fields(3) = Trim(Text1(3).Text)
dream.UpdateBatch
dream.Close
'==============================
End If
End Sub
Private Sub Command8_Click()
dream.Bookmark = mybookmark
Call viewdata
End Sub
Private Sub Command9_Click()
dream.Bookmark = mybookmark
Call viewdata
End Sub
Private Sub Form_Load()
txtSQL = "select * from class "
Set dream = ExecuteSQL(txtSQL, Msgtext) '執行查詢操作
dream.MoveFirst '移到第一條記錄
Call viewdata '顯示記錄
mcbookmark = dream.Bookmark '記下當前記錄的位置
Text1(0).Enabled = False
Text1(1).Enabled = False
Text1(2).Enabled = False
Text1(3).Enabled = False
modclass.Height = 4365
modclass.Width = 8850
modclass.Caption = "修改班級信息.....[" + Format(Date, "yyyy年mm月dd日]")
studentmdi.StatusBar1.Panels.Item(1).Text = "修改班級信息"
End Sub
Public Sub viewdata() '由于程序中各處需要顯示數據,定義函數ViewData
Text1(0).Text = dream.Fields(0)
Text1(1).Text = dream.Fields(1)
Text1(2).Text = dream.Fields(2)
Text1(3).Text = dream.Fields(3)
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -