📄 frmhwbm.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form frmHwbm
Caption = "货物资料维护"
ClientHeight = 7215
ClientLeft = 1020
ClientTop = 1185
ClientWidth = 12540
LinkTopic = "Form2"
LockControls = -1 'True
ScaleHeight = 7215
ScaleWidth = 12540
Begin VB.CommandButton Command
Caption = "保存(&S)"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 525
Index = 3
Left = 9300
TabIndex = 12
Top = 3360
Width = 1785
End
Begin VB.CommandButton Command
Caption = "新增(&A)"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 525
Index = 0
Left = 5070
TabIndex = 11
Top = 3360
Width = 1785
End
Begin MSFlexGridLib.MSFlexGrid Flex
Height = 6825
Index = 0
Left = 90
TabIndex = 10
Top = 150
Width = 4845
_ExtentX = 8546
_ExtentY = 12039
_Version = 393216
Cols = 4
AllowUserResizing= 3
FormatString = "|<货物分类码|<货物编码|<货物名称"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.CommandButton Command
Caption = "删除(&D)"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 525
Index = 2
Left = 7170
TabIndex = 6
Top = 3360
Width = 1785
End
Begin VB.Frame Frame
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 3105
Left = 5070
TabIndex = 0
Top = 60
Width = 7305
Begin VB.TextBox Text
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Index = 3
Left = 1500
TabIndex = 9
Top = 300
Width = 2175
End
Begin VB.TextBox Text
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Index = 2
Left = 1500
TabIndex = 7
Top = 2280
Width = 2175
End
Begin VB.TextBox Text
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Index = 0
Left = 1500
TabIndex = 2
Top = 960
Width = 2175
End
Begin VB.TextBox Text
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Index = 1
Left = 1500
TabIndex = 1
Top = 1620
Width = 3465
End
Begin VB.Label Label
Caption = "货物单价:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 3
Left = 180
TabIndex = 8
Top = 2340
Width = 1245
End
Begin VB.Label Label
Caption = "货物编码:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 0
Left = 180
TabIndex = 5
Top = 1000
Width = 1245
End
Begin VB.Label Label
Caption = "货物名称:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 1
Left = 180
TabIndex = 4
Top = 1670
Width = 1245
End
Begin VB.Label Label
Caption = "货物分类:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 2
Left = 180
TabIndex = 3
Top = 330
Width = 1245
End
End
End
Attribute VB_Name = "frmHwbm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Const FlexHwbm = 0
Const TxtHwBmFlCode = 3
Const TxtHwBmCode = 0
Const TxtHwBmMc = 1
Const TxtHwBmPrice = 2
Const CmdAdd = 0
Const CmdDel = 2
Const CmdSave = 3
Dim OHwbm As Hwbm
Dim OHwbms As Hwbms
Private Sub Command_Click(Index As Integer)
On Error GoTo Errorhandle
Select Case Index
Case CmdAdd
AddRecord
Case CmdDel
Delrecord
Case CmdSave
SaveRecord
End Select
Exit Sub
Errorhandle:
MsgBox Err.Description
End Sub
Private Sub Form_Load()
On Error GoTo Errorhandle
LoadDataIntoGrid
Exit Sub
Errorhandle:
MsgBox Err.Description
End Sub
Private Sub LoadDataIntoGrid()
Dim ItemStr As String
Dim mHwbm As Hwbm
On Error GoTo Errorhandle
Flex(FlexHwbm).Rows = 1
Set OHwbms = New Hwbms
OHwbms.Fillbydb
For Each mHwbm In OHwbms
ItemStr = vbTab & mHwbm.HwBmFlCode & vbTab & mHwbm.HwBmCode & vbTab & mHwbm.HwBmMc
Flex(FlexHwbm).AddItem ItemStr
Flex(FlexHwbm).RowData(Flex(FlexHwbm).Rows - 1) = mHwbm.HwbmKey
Next
If Flex(FlexHwbm).Rows > 1 Then
Flex(FlexHwbm).Row = 1
Set OHwbm = OHwbms(CStr(Flex(FlexHwbm).RowData(1)))
SetValueToControl
Else
Set OHwbm = Nothing
Clearcontrol
End If
Exit Sub
Errorhandle:
Err.Raise vbObjectError + 1, , Err.Description
End Sub
Private Sub AddRecord()
On Error GoTo Errorhandle
Set OHwbm = New Hwbm
Clearcontrol
Text(TxtHwBmFlCode).SetFocus
Exit Sub
Errorhandle:
Err.Raise vbObjectError + 1, , Err.Description
End Sub
Private Sub Clearcontrol()
On Error GoTo Errorhandle
Text(TxtHwBmFlCode).Text = ""
Text(TxtHwBmCode).Text = ""
Text(TxtHwBmMc).Text = ""
Text(TxtHwBmPrice).Text = ""
Exit Sub
Errorhandle:
Err.Raise vbObjectError + 1, , Err.Description
End Sub
Private Sub SaveRecord()
On Error GoTo Errorhandle
SetValueToObject
If OHwbm.HwbmId = -1 Then
OHwbms.Add OHwbm
ChgGrid "ADD"
Else
OHwbm.Save
ChgGrid "CHG"
End If
Exit Sub
Errorhandle:
Err.Raise vbObjectError + 1, , Err.Description
End Sub
Private Sub SetValueToObject()
On Error GoTo Errorhandle
OHwbm.HwBmFlCode = Trim(Text(TxtHwBmFlCode).Text)
OHwbm.HwBmCode = Trim(Text(TxtHwBmCode).Text)
OHwbm.HwBmMc = Trim(Text(TxtHwBmMc).Text)
OHwbm.HwBmPrice = Val(Text(TxtHwBmPrice).Text)
Exit Sub
Errorhandle:
Err.Raise vbObjectError + 1, , Err.Description
End Sub
Private Sub ChgGrid(RecordName As String)
Dim ItemStr As String
On Error GoTo Errorhandle
If RecordName = "ADD" Then
ItemStr = vbTab & OHwbm.HwBmFlCode & vbTab & OHwbm.HwBmCode & vbTab & OHwbm.HwBmMc
Flex(FlexHwbm).AddItem ItemStr
Flex(FlexHwbm).RowData(Flex(FlexHwbm).Rows - 1) = OHwbm.HwbmKey
Flex(FlexHwbm).Row = Flex(FlexHwbm).Rows - 1
Else
Flex(FlexHwbm).TextMatrix(Flex(FlexHwbm).Row, 1) = Text(TxtHwBmFlCode).Text
Flex(FlexHwbm).TextMatrix(Flex(FlexHwbm).Row, 2) = Text(TxtHwBmCode).Text
Flex(FlexHwbm).TextMatrix(Flex(FlexHwbm).Row, 3) = Text(TxtHwBmMc).Text
End If
Exit Sub
Errorhandle:
Err.Raise vbObjectError + 1, , Err.Description
End Sub
Private Sub Delrecord()
On Error GoTo Errorhandle
If Flex(FlexHwbm).Rows = 1 Then
Exit Sub
End If
If MsgBox("您真的要删除吗?", vbYesNo) = vbYes Then
OHwbms.Remove CStr(OHwbm.HwbmKey)
Flex(FlexHwbm).RemoveItem Flex(FlexHwbm).Row
If Flex(FlexHwbm).Rows = 1 Then
Set OHwbm = Nothing
Clearcontrol
Else
Set OHwbm = OHwbms(CStr(Flex(FlexHwbm).RowData(Flex(FlexHwbm).Row)))
SetValueToControl
End If
End If
Exit Sub
Errorhandle:
Err.Raise vbObjectError + 1, , Err.Description
End Sub
Private Sub Flex_RowColChange(Index As Integer)
On Error GoTo Errorhandle
If Flex(FlexHwbm).Rows >= 1 Then
Set OHwbm = OHwbms(CStr(Flex(FlexHwbm).RowData(Flex(FlexHwbm).Row)))
SetValueToControl
Else
Set OHwbm = Nothing
Clearcontrol
End If
Exit Sub
Errorhandle:
MsgBox Err.Description
End Sub
Private Sub SetValueToControl()
On Error GoTo Errorhandle
Text(TxtHwBmFlCode).Text = OHwbm.HwBmFlCode
Text(TxtHwBmCode).Text = OHwbm.HwBmCode
Text(TxtHwBmMc).Text = OHwbm.HwBmMc
Text(TxtHwBmPrice).Text = OHwbm.HwBmPrice
Exit Sub
Errorhandle:
Err.Raise vbObjectError + 1, , Err.Description
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error GoTo Errorhandle
Set OHwbm = Nothing
Set OHwbms = Nothing
Exit Sub
Errorhandle:
MsgBox Err.Description
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -