📄 frmfoodedie.frm
字号:
VERSION 5.00
Begin VB.Form FrmFoodEdit
Caption = "编辑食品基本信息"
ClientHeight = 4080
ClientLeft = 60
ClientTop = 450
ClientWidth = 6870
LinkTopic = "Form1"
ScaleHeight = 4080
ScaleWidth = 6870
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "关闭"
Height = 615
Left = 3960
TabIndex = 10
Top = 3360
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 615
Left = 1320
TabIndex = 9
Top = 3360
Width = 1455
End
Begin VB.Frame Frame1
Height = 3135
Left = 0
TabIndex = 0
Top = 0
Width = 6855
Begin VB.TextBox txtNo
Height = 375
Left = 1440
TabIndex = 4
Top = 240
Width = 1575
End
Begin VB.TextBox txtName
Height = 375
Left = 1440
TabIndex = 3
Top = 1200
Width = 1575
End
Begin VB.TextBox txtPrice
Height = 375
Left = 1440
TabIndex = 2
Top = 1800
Width = 1575
End
Begin VB.ComboBox ComboFoodClass
Height = 300
Left = 1440
TabIndex = 1
Text = "Combo1"
Top = 720
Width = 1575
End
Begin VB.Label Label1
Caption = "食品编号"
Height = 255
Left = 240
TabIndex = 8
Top = 240
Width = 1215
End
Begin VB.Label Label2
Caption = "食品名称"
Height = 255
Left = 240
TabIndex = 7
Top = 1320
Width = 1215
End
Begin VB.Label Label3
Caption = "价格"
Height = 255
Left = 240
TabIndex = 6
Top = 1920
Width = 1215
End
Begin VB.Label Label4
Caption = "食品类型"
Height = 375
Left = 240
TabIndex = 5
Top = 720
Width = 1335
End
End
End
Attribute VB_Name = "FrmFoodEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean
Public OriFoodNo As String
Private Sub Command1_Click()
If Trim(txtNo) = "" Then
MsgBox "请输入食品编号"
txtNo.SetFocus
Exit Sub
End If
If Trim(ComboFoodClass.Text) = "" Then
MsgBox "请输入食品类别"
ComboFoodClass.SetFocus
Exit Sub
End If
If Trim(txtName) = "" Then
MsgBox "请输入食品名称"
txtName.SetFocus
Exit Sub
End If
If Trim(txtPrice) = "" Then
MsgBox "请输入食品价格"
txtPrice.SetFocus
Exit Sub
End If
With MyFood
.FoodNo = MakeStr(txtNo)
.FoodClass = MakeStr(ComboFoodClass.Text)
.FoodName = MakeStr(txtName)
.Price = MakeStr(txtPrice)
'Modify=False表示当前为插入新数据状态;否则为修改数据状态
If Modify = False Then
'判断当前用户是否存在
.Insert
Else
If Trim(FoodNo) = OriFoodNo Then
.Update (OriFoodNo)
Else
If .In_DB(OriFoodNo) = True Then
.Update (OriFoodNo)
Else
MsgBox "已经存在此类编号"
txtNo.SetFocus
Exit Sub
End If
End If
End If
End With
FrmFood.AdoFoodList.Refresh
Unload Me
End Sub
Private Sub txtPostcode_KeyPress(KeyAscii As Integer)
If In_Int(KeyAscii) = False Then
KeyAscii = 0
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim i As Integer
MyFood.Loadtype
ComboFoodClass.Clear
i = 0
Do While Arr_FoodClass(i) <> ""
ComboFoodClass.AddItem Arr_FoodClass(i)
i = i + 1
Loop
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -