📄 frmproedit.frm
字号:
VERSION 5.00
Begin VB.Form frmproedit
Caption = "编辑产品信息"
ClientHeight = 4905
ClientLeft = 60
ClientTop = 345
ClientWidth = 6675
Icon = "frmproedit.frx":0000
LinkTopic = "Form1"
ScaleHeight = 4905
ScaleWidth = 6675
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton cmd_cancel
Caption = "取消"
Height = 375
Left = 3840
TabIndex = 19
Top = 3960
Width = 1695
End
Begin VB.CommandButton cmd_ok
Caption = "确定"
Height = 375
Left = 720
TabIndex = 18
Top = 3960
Width = 1695
End
Begin VB.Frame Frame1
Height = 3375
Left = 120
TabIndex = 0
Top = 240
Width = 6375
Begin VB.ComboBox Combotype2
Height = 300
Left = 3360
TabIndex = 21
Text = "combotype2"
Top = 840
Width = 1455
End
Begin VB.ComboBox Combotype1
Height = 300
ItemData = "frmproedit.frx":0CCA
Left = 1440
List = "frmproedit.frx":0CCC
TabIndex = 20
Text = "combotype1"
Top = 840
Width = 1455
End
Begin VB.TextBox txtpro
Height = 375
Left = 1440
TabIndex = 17
Top = 360
Width = 4455
End
Begin VB.TextBox txtunit
Height = 270
Left = 4440
TabIndex = 16
Top = 1320
Width = 1455
End
Begin VB.TextBox txtprice
Height = 270
Left = 1440
TabIndex = 15
Top = 1800
Width = 1455
End
Begin VB.TextBox txtstyle
Height = 270
Left = 1440
TabIndex = 14
Top = 1320
Width = 1455
End
Begin VB.TextBox txtmin
Height = 270
Left = 1440
TabIndex = 13
Top = 2280
Width = 1455
End
Begin VB.TextBox txtmax
Height = 270
Left = 4440
TabIndex = 12
Top = 1800
Width = 1455
End
Begin VB.TextBox txtalarm
Height = 270
Left = 4440
TabIndex = 11
Top = 2280
Width = 1455
End
Begin VB.TextBox txtvalid
Height = 270
Left = 1440
TabIndex = 10
Top = 2760
Width = 1455
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "数量下限"
Height = 180
Left = 360
TabIndex = 9
Top = 2400
Width = 720
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "数量上限"
Height = 180
Left = 3360
TabIndex = 8
Top = 1920
Width = 720
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "有效期(天)"
Height = 180
Left = 360
TabIndex = 7
Top = 2880
Width = 900
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "警告期(天)"
Height = 180
Left = 3360
TabIndex = 6
Top = 2400
Width = 900
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "计量单位"
Height = 180
Left = 3360
TabIndex = 5
Top = 1440
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "产品型号"
Height = 180
Left = 360
TabIndex = 4
Top = 1440
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "产品类目"
Height = 180
Left = 360
TabIndex = 3
Top = 960
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "参与价格"
Height = 180
Left = 360
TabIndex = 2
Top = 1920
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "产品名称"
Height = 180
Left = 360
TabIndex = 1
Top = 480
Width = 720
End
End
End
Attribute VB_Name = "frmproedit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean
Public OriId As Long
Public OriName As String
Public OriType1, OriType2 As String
Private Function Check() As Boolean
If Trim(txtpro) = "" Then
MsgBox "请输入产品名称"
txtpro.SetFocus
Check = False
Exit Function
End If
If combotype1.Text = "" Or combotype2.Text = "" Then
MsgBox "请选择产品类目"
combotype1.SetFocus
Check = False
Exit Function
End If
Check = True
End Function
Private Sub Cmd_OK_Click()
If Check = False Then
Exit Sub
End If
With MyPro
.ProName = MakeStr(txtpro)
If combotype2.Text <> "" Then
.TypeId = MyProType.GetId(combotype2.Text)
Else
.TypeId = MyProType.GetId(combotype1.Text)
End If
.ProStyle = MakeStr(txtstyle)
.ProUnit = MakeStr(txtunit)
.ProPrice = Val(txtprice)
.ProLow = Val(txtmin)
.ProHigh = Val(txtmax)
.Valid = Val(txtvalid)
.AlarmDays = Val(txtalarm)
'判断仓库名称是否存在
If Modify = False Or OriName <> Trim(txtpro) Then
If .In_DB(MakeStr(txtpro)) = True Then
MsgBox "产品名称已经存在,请重新输入"
txtpro.SetFocus
txtpro.SelStart = 0
txtpro.SelLength = Len(txtpro)
Exit Sub
End If
End If
If Modify = False Then
.Insert
MsgBox "添加成功"
Else
.Update (OriId)
MsgBox "修改成功"
End If
End With
Unload Me
End Sub
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub txtContact_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtDescribe_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub ComboType1_Click()
'装入二级类目
TmpType = MyProType.GetId(combotype1.Text)
MyProType.Load_by_Upper (TmpType)
combotype2.Clear
i = 0
Do While Arr_ProType(i) <> ""
combotype2.AddItem Arr_ProType(i)
i = i + 1
Loop
If combotype2.ListCount > 0 Then
combotype2.ListIndex = 0
End If
End Sub
Private Sub Form_Load()
Dim TmpType As Long
Dim i As Integer
'装入一级类目
MyProType.Load_by_Upper (0)
i = 0
Do While Arr_ProType(i) <> ""
combotype1.AddItem Arr_ProType(i)
i = i + 1
Loop
If OriType1 = "" Then
If combotype1.ListCount > 0 Then
combotype1.ListIndex = 0
End If
Else
If InCombo(OriType1, combotype1) = True Then
combotype1.Text = OriType1
End If
End If
'装入二级类目
TmpType = MyProType.GetId(combotype1.Text)
MyProType.Load_by_Upper (TmpType)
combotype2.Clear
i = 0
Do While Arr_ProType(i) <> ""
combotype2.AddItem Arr_ProType(i)
i = i + 1
Loop
If OriType2 = "" Then
If combotype2.ListCount > 0 Then
combotype2.ListIndex = 0
End If
Else
If InCombo(OriType2, combotype2) = True Then
combotype2.Text = OriType2
End If
End If
End Sub
Private Sub Label4_Click()
End Sub
Private Sub txtAlarm_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
If In_Int(KeyAscii) = False Then
KeyAscii = 0
End If
End Sub
Private Sub txtMax_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
If In_Int(KeyAscii) = False Then
KeyAscii = 0
End If
End Sub
Private Sub txtMin_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
If In_Int(KeyAscii) = False Then
KeyAscii = 0
End If
End Sub
Private Sub txtPro_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtStyle_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtUnit_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtPrice_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
If In_Single(KeyAscii) = False Then
KeyAscii = 0
End If
End Sub
Private Sub txtValid_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
If In_Int(KeyAscii) = False Then
KeyAscii = 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -