frmpizza.frm
来自「Gestion de una pizza rapida y sencilla」· FRM 代码 · 共 279 行
FRM
279 行
VERSION 5.00
Begin VB.Form FRMPIZZA
Caption = "VENKY'S PIZZA HOUSE-PIZZA DETAILS"
ClientHeight = 5070
ClientLeft = 60
ClientTop = 450
ClientWidth = 7455
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Picture = "FRMPIZZA.frx":0000
ScaleHeight = 5070
ScaleWidth = 7455
StartUpPosition = 3 'Windows Default
Begin VB.ComboBox Combo1
Height = 315
Left = 4200
TabIndex = 11
Top = 1200
Width = 2415
End
Begin VB.TextBox Text1
Height = 285
Left = 4200
TabIndex = 7
Top = 1200
Width = 2415
End
Begin VB.TextBox Text2
Height = 285
Left = 4200
TabIndex = 6
Top = 1680
Width = 2415
End
Begin VB.TextBox Text3
Height = 285
Left = 4200
TabIndex = 5
Top = 2280
Width = 2295
End
Begin VB.CommandButton Command1
Height = 375
Left = 1320
Picture = "FRMPIZZA.frx":8CF0
Style = 1 'Graphical
TabIndex = 4
Top = 3240
Width = 855
End
Begin VB.CommandButton Command2
Height = 375
Left = 2520
Picture = "FRMPIZZA.frx":963E
Style = 1 'Graphical
TabIndex = 3
Top = 3240
Width = 975
End
Begin VB.CommandButton Command3
Height = 375
Left = 4080
Picture = "FRMPIZZA.frx":A00C
Style = 1 'Graphical
TabIndex = 2
Top = 3240
Width = 975
End
Begin VB.CommandButton Command4
Height = 375
Left = 5760
Picture = "FRMPIZZA.frx":A96B
Style = 1 'Graphical
TabIndex = 1
Top = 3240
Width = 1095
End
Begin VB.CommandButton Command5
Height = 375
Left = 3360
Picture = "FRMPIZZA.frx":B413
Style = 1 'Graphical
TabIndex = 0
Top = 4080
Width = 975
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H00FF8080&
Caption = "PIZZA ID"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 240
Left = 1560
TabIndex = 10
Top = 1320
Width = 930
End
Begin VB.Label Label2
AutoSize = -1 'True
BackColor = &H00FF8080&
Caption = "PIZZA NAME AND SIZE"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 240
Left = 1080
TabIndex = 9
Top = 1800
Width = 2445
End
Begin VB.Label Label3
AutoSize = -1 'True
BackColor = &H00FF8080&
Caption = "PRICE"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 240
Left = 2280
TabIndex = 8
Top = 2280
Width = 690
End
End
Attribute VB_Name = "FRMPIZZA"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim DB As New ADODB.Connection
Dim RS As New ADODB.Recordset
Private Sub Combo1_Click()
Text1.Text = Combo1.Text
Combo1.Visible = False
RS.MoveFirst
A = Text1.Text
RS.Find ("PID='" & A & " ' ")
Text1.Text = RS.Fields("PID")
Text2.Text = RS.Fields("PNAME")
Text3.Text = RS.Fields("PRICE")
End Sub
Private Sub Command1_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
If (RS.RecordCount = 0) Then
Text1.Text = 1
Else
RS.MoveLast
Text1.Text = RS.Fields("PID") + 1
End If
RS.AddNew
End Sub
Private Sub Command2_Click()
On Error GoTo HAND
X% = MsgBox("CONFORM SAVE", vbInformation + vbYesNo, "CONFORM SAVE")
If (X% = vbYes) Then
RS.Fields("PID") = Text1.Text
RS.Fields("PNAME") = Text2.Text
RS.Fields("PRICE") = Text3.Text
RS.Update
MsgBox " RECORD SAVED", vbInformation, "RECORD SAVED"
Else
MsgBox " SAVE ABORTED", vbInformation, "RECORD NOT SAVED"
End If
Exit Sub
HAND:
MsgBox Err.Description, vbCritical, " EXCUSE ME"
End Sub
Private Sub Command3_Click()
Combo1.Visible = True
Combo1.Clear
RS.MoveFirst
While (RS.EOF = False)
Combo1.AddItem RS.Fields("PID")
RS.MoveNext
Wend
End Sub
Private Sub Command4_Click()
X% = MsgBox("CONFORM DELETE", vbInformation + vbYesNo, "CONFORM SAVE")
If (X% = vbYes) Then
RS.Delete
MsgBox " RECORS DELETED", vbInformation, "EXCUSE ME"
If (RS.RecordCount = 0) Then
MsgBox " NO RECORS AVALABLE ALL DELETED", vbCritical, "VENKY'S PIZZA HOUSE"
Else
RS.MoveFirst
Text1.Text = RS.Fields("PID")
Text2.Text = RS.Fields("PNAME")
Text3.Text = RS.Fields("PRICE")
End If
Else
MsgBox " DELETE ABORTED", vbCritical, "EXSCUSE ME"
End If
End Sub
Private Sub Command5_Click()
Unload Me
End Sub
Private Sub Form_Load()
DB.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\pizza.mdb;Persist Security Info=False"
RS.Open "PIZZA", DB, 1, 3
Combo1.Visible = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
RS.Close
DB.Close
frmindex.Show
End Sub
Private Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)
End Sub
Private Sub Text1_GotFocus()
Text1.BackColor = &HC0FFC0
End Sub
Private Sub Text1_LostFocus()
Text1.BackColor = &H80000005
End Sub
Private Sub Text2_GotFocus()
Text2.BackColor = &HC0FFC0
End Sub
Private Sub Text2_LostFocus()
Text2.BackColor = &H80000005
End Sub
Private Sub Text3_GotFocus()
Text3.BackColor = &HC0FFC0
End Sub
Private Sub Text3_LostFocus()
Text3.BackColor = &H80000005
End Sub
Private Sub Combo1_GotFocus()
Combo1.BackColor = &HFFFFC0
End Sub
Private Sub Combo1_LostFocus()
Combo1.BackColor = &H80000005
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?