【VB开源代码栏目提醒】:网学会员在VB开源代码频道为大家收集整理了FrmChargeItemEdit.frm提供大家参考,希望对大家有所帮助!
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form FrmChargeItemEdit
BorderStyle = 1 'Fixed Single
Caption = "编辑收费项目信息"
ClientHeight = 2085
ClientLeft = 45
ClientTop = 345
ClientWidth = 6270
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2085
ScaleWidth = 6270
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc Ado_Cycle
Height = 375
Left = 240
Top = 1440
Visible = 0 'False
Width = 1455
_ExtentX = 2566
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Pass
word = ""
RecordSource = ""
Caption = "Ado_Cycle"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.CommandButton Cmd_Cancel
Cancel = -1 'True
Caption = "取 消"
Height = 400
Left = 3565
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 3
Top = 1440
Width = 1300
End
Begin VB.CommandButton Cmd_OK
Caption = "确 定"
Height = 400
Left = 1405
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 2
Top = 1440
Width = 1300
End
Begin VB.Frame Frame1
Height = 1095
Left = 240
TabIndex = 4
Top = 120
Width = 5775
Begin MSDataListLib.DataCombo dco_Cycle
Height = 330
Left = 1200
TabIndex = 10
Top = 600
Width = 1455
_ExtentX = 2566
_ExtentY = 582
_Version = 393216
Text = ""
End
Begin VB.ComboBox cob_Unit
Height = 300
Left = 4080
Style = 2 'Dropdown List
TabIndex = 9
Top = 600
Width = 1455
End
Begin VB.TextBox txtUnitPrice
Height = 270
Left = 4080
MaxLength = 20
TabIndex = 1
Top = 195
Width = 1455
End
Begin VB.TextBox txtItem
Height = 270
Left = 1200
MaxLength = 20
TabIndex = 0
Top = 195
Width = 1455
End
Begin
VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "收费单位"
Height = 180
Left = 3120
TabIndex = 8
Top = 645
Width = 720
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "收费单价"
Height = 180
Left = 3120
TabIndex = 7
Top = 240
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "收费项目"
Height = 180
Left = 240
TabIndex = 6
Top = 240
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "收费周期"
Height = 180
Left = 240
TabIndex = 5
Top = 645
Width = 720
End
End
End
Attribute VB_Name = "FrmChargeItemEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean
Public OriId As Long
Private Function Check() As Boolean
If Trim(txtItem) = "" Then
MsgBox "请输入收费项目"
txtItem.SetFocus
Check = False
Exit Function
End If
If Trim(dco_Cycle.Text) = "" Then
MsgBox "请选择收费周期"
dco_Cycle.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 MyChargeItem
.ItemName = Trim(txtItem)
.UnitPrice = Val(txtUnitPrice)
.ItemType = Trim(cob_Unit.ListIndex)
.PayCycle = Trim(dco_Cycle.Text)
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 Form_Load()
'装入收费周期
Ado_Cycle.ConnectionString = Conn
Ado_Cycle.RecordSource = "Select Distinct PayCycle From ChargeItem Order By PayCycle"
Ado_Cycle.Refresh
Set dco_Cycle.RowSource = Ado_Cycle
dco_Cycle.ListField = "PayCycle"
'装入收费单位
cob_Unit.AddItem "按建筑面积", 0
cob_Unit.AddItem "按抄表刻度", 1
cob_Unit.AddItem "按总费用", 2
cob_Unit.ListIndex = 1
End Sub