【VB开源代码栏目提醒】:网学会员在VB开源代码频道为大家收集整理了E参数配置.frm提供大家参考,希望对大家有所帮助!
VERSION 5.00
Begin VB.Form frmParameters
Caption = "参数配置"
ClientHeight = 3855
ClientLeft = 60
ClientTop = 345
ClientWidth = 4860
LinkTopic = "Form1"
ScaleHeight = 3855
ScaleWidth = 4860
StartUpPosition = 3 '窗口缺省
Begin VB.Frame frame1
Caption = "参数配置"
Height = 3615
Left = 120
TabIndex = 0
Top = 120
Width = 4575
Begin VB.CommandButton CmdExit
BackColor = &H00C0C0C0&
Caption = "退出"
Height = 360
Left = 3120
Style = 1 'Graphical
TabIndex = 13
Top = 3000
Width = 800
End
Begin VB.CommandButton CmdCancel
BackColor = &H00C0C0C0&
Caption = "取消"
Height = 360
Left = 2280
Style = 1 'Graphical
TabIndex = 12
Top = 3000
Width = 800
End
Begin VB.CommandButton CmdSave
BackColor = &H00C0C0C0&
Caption = "保存"
Height = 360
Left = 1440
Style = 1 'Graphical
TabIndex = 11
Top = 3000
Width = 800
End
Begin VB.TextBox txtMaxPenalty
Height = 375
Left = 1680
MaxLength = 50
TabIndex = 5
Text = "10.0"
Top = 1920
Width = 2175
End
Begin VB.TextBox txtDayPenalty
Height = 375
Left = 1680
MaxLength = 18
TabIndex = 4
Text = "0.5"
Top = 2400
Width = 2175
End
Begin VB.TextBox txtMaxBorrow
Height = 375
Left = 1680
MaxLength = 18
TabIndex = 3
Text = "3"
Top = 1440
Width = 2175
End
Begin VB.TextBox txtBorrowLimite
Height = 375
Left = 1680
MaxLength = 12
TabIndex = 2
Text = "30"
Top = 480
Width = 2175
End
Begin
VB.TextBox txtContinueLimite
Height = 375
Left = 1680
MaxLength = 18
TabIndex = 1
Text = "10"
Top = 960
Width = 2175
End
Begin VB.Label Label5
Caption = "最高罚款额:"
Height = 375
Index = 2
Left = 480
TabIndex = 10
Top = 1920
Width = 1215
End
Begin VB.Label Label7
Caption = "每日罚款:"
Height = 375
Index = 1
Left = 600
TabIndex = 9
Top = 2400
Width = 975
End
Begin VB.Label Label5
Caption = "最大借书量:"
Height = 255
Index = 1
Left = 480
TabIndex = 8
Top = 1560
Width = 1215
End
Begin VB.Label Label5
Caption = "续借时限:"
Height = 255
Index = 0
Left = 600
TabIndex = 7
Top = 1080
Width = 1095
End
Begin VB.Label Label2
Caption = "借书时限:"
Height = 255
Left = 600
TabIndex = 6
Top = 600
Width = 975
End
End
End
Attribute VB_Name = "frmParameters"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs As ADODB.Recordset
Dim SQL As String
Dim msg As String
Private Sub Form_Load()
'初始化控件
Call LoadData
End Sub
Private Sub LoadData()
'得到参数
SQL = " select * from 参数配置表 "
Set rs = SelectSQL(SQL, msg)
If rs.RecordCount > 0 Then '如果存在记录
txtBorrowLimite.Text = rs.Fields("borrowTL")
txtContinueLimite.Text = rs.Fields("borrow2TL")
txtMaxBorrow.Text = rs.Fields("maxBooks")
txtMaxPenalty.Text = rs.Fields("maxFines")
txtDayPenalty.Text = rs.Fields("finedaily")
End If
End Sub
Private Sub cmdCancel_Click()
'取消操作
Call LoadData '重新得到数据
End Sub
Private Sub CmdSave_Click()
On Error GoTo ErrMsg '出错处理
msg = MsgBox("您确实要修改
系统参数吗?", vbYesNo)
If msg = vbYes Then
Call setData
rs.Update '更新数据
MsgBox ("成功更新数据!")
Call LoadData '重新得到数据
Else
Exit Sub
End If
Exit Sub
ErrMsg:
MsgBox Err.Description, vbExclamation, "出错"
End Sub
Private Sub setData()
'为字段设置数据
rs.Fields("borrowTL") = CInt(txtBorrowLimite.Text)
rs.Fields("borrow2TL") = CInt(txtContinueLimite.Text)
rs.Fields("maxBooks") = CInt(txtMaxBorrow.Text)
rs.Fields("maxFines") = CDbl(txtMaxPenalty.Text)
rs.Fields("finedaily") = CDbl(txtDayPenalty.Text)
End Sub
Private Sub CmdExit_Click()
'退出操作
LibInfoSerSys.Enabled = True
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
'退出操作
LibInfoSerSys.Enabled = True
rs.Close
Unload Me
End Sub