📄 editcd.frm
字号:
VERSION 5.00
Begin VB.Form EditCD
BorderStyle = 1 'Fixed Single
Caption = "影碟信息修改"
ClientHeight = 2760
ClientLeft = 45
ClientTop = 435
ClientWidth = 7455
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 2760
ScaleWidth = 7455
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 375
Index = 1
Left = 5160
TabIndex = 4
Top = 360
Width = 1695
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 375
Index = 3
Left = 1320
TabIndex = 3
Top = 1560
Width = 1695
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H0000FFFF&
Enabled = 0 'False
Height = 375
Index = 4
Left = 5160
TabIndex = 2
Top = 1560
Width = 1695
End
Begin VB.CommandButton Command1
Caption = "修改(&E)"
Height = 375
Left = 4440
TabIndex = 1
Top = 2280
Width = 1455
End
Begin VB.CommandButton Command2
Caption = "关闭(&C)"
Height = 375
Left = 6000
TabIndex = 0
Top = 2280
Width = 1335
End
Begin VB.Frame Frame1
Caption = "影碟信息"
Height = 2055
Left = 120
TabIndex = 5
Top = 120
Width = 7215
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H0000FFFF&
Height = 375
Index = 0
Left = 1200
TabIndex = 8
Top = 240
Width = 1695
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 375
Index = 2
Left = 1200
TabIndex = 7
Top = 840
Width = 1695
End
Begin VB.ComboBox Combo1
Appearance = 0 'Flat
Height = 300
Left = 5040
TabIndex = 6
Top = 840
Width = 1695
End
Begin VB.Label Label1
Caption = "影碟编号:"
Height = 255
Index = 0
Left = 240
TabIndex = 14
Top = 360
Width = 975
End
Begin VB.Label Label1
Caption = "影碟名称:"
Height = 375
Index = 1
Left = 3960
TabIndex = 13
Top = 360
Width = 975
End
Begin VB.Label Label1
Caption = "影碟价格:"
Height = 375
Index = 2
Left = 240
TabIndex = 12
Top = 960
Width = 975
End
Begin VB.Label Label1
Caption = "光碟数量:"
Height = 255
Index = 3
Left = 240
TabIndex = 11
Top = 1560
Width = 975
End
Begin VB.Label Label1
Caption = "影碟类别:"
Height = 255
Index = 4
Left = 3960
TabIndex = 10
Top = 960
Width = 975
End
Begin VB.Label Label1
Caption = "登入时间:"
Height = 375
Index = 5
Left = 3960
TabIndex = 9
Top = 1560
Width = 975
End
End
End
Attribute VB_Name = "EditCD"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Combo1_Change()
Combo1.Text = ""
End Sub
Private Sub Command1_Click()
Dim SQL As String
Dim i As Integer
For i = 1 To 3
If Text1(i) = "" Then
MsgBox "对不起:" & Label1(i).Caption & "不能为空!", vbInformation + vbOKOnly, "警告"
Text1(i).SetFocus
Exit Sub
End If
Next
If Combo1.Text = "" Then
MsgBox "对不起:影碟类别:不能为空!", vbInformation + vbOKOnly, "警告"
Combo1.SetFocus
End If
SQL = "select * from cdtype where 影碟类别=""" & CStr(Combo1.Text) & """"
OpenDBFile
OpenRS (SQL)
If Not gRst.BOF Then
gRst.MoveFirst
End If
If gRst.EOF Then
MsgBox "对不起,你输入的影碟类别不存在,请选择存在的影碟类别!", vbInformation + vbOKOnly, "警告"
Combo1.Text = ""
Combo1.SetFocus
CloseRS
Exit Sub
End If
CloseRS
SQL = "update cdinfo set 影碟名称=""" & Text1(1).Text & """,影碟价格=" & Text1(2).Text & ",影碟类别=""" & Combo1.Text & """,光碟数量=" & Text1(3).Text & " where 影碟编号=""" & Text1(0).Text & """"
OpenDBFile
gCon.Execute SQL
CloseDBFile
FindCD.Adodc1.Refresh
MsgBox "影碟编号为“" & Text1(0).Text & "”的信息修改成功,请返回!", vbInformation + vbOKOnly, "提示"
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim SQL As String
Dim i As Integer
SQL = "select 影碟类别 from cdtype"
OpenDBFile
OpenRS (SQL)
gRst.MoveFirst
Do While Not gRst.EOF
Combo1.AddItem gRst("影碟类别")
gRst.MoveNext
Loop
CloseRS
For i = 0 To 3
FindCD.DataGrid1.Col = i
Text1(i).Text = FindCD.DataGrid1.Text
Next
FindCD.DataGrid1.Col = 5
Combo1.Text = FindCD.DataGrid1.Text
FindCD.DataGrid1.Col = 7
Text1(4).Text = FindCD.DataGrid1.Text
Text1(0).Enabled = False
Text1(4).Enabled = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -