📄 formbanset.frm
字号:
_ExtentY = 1296
ButtonWidth = 820
ButtonHeight = 1138
Appearance = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 7
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "新建"
Object.ToolTipText = "新建"
ImageIndex = 1
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "删除"
Object.ToolTipText = "删除"
ImageIndex = 2
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "刷新"
Object.ToolTipText = "刷新"
ImageIndex = 3
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "保存"
Object.ToolTipText = "保存"
ImageIndex = 4
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "取消"
Object.ToolTipText = "取消"
ImageIndex = 5
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "退出"
Object.ToolTipText = "退出"
ImageIndex = 6
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "修改"
ImageIndex = 7
EndProperty
EndProperty
End
Begin MSComctlLib.ImageList ImageList1
Left = 960
Top = 4920
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 24
ImageHeight = 23
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 7
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Formbanset.frx":0460
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Formbanset.frx":0ADA
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Formbanset.frx":0C5C
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Formbanset.frx":12D6
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Formbanset.frx":13E8
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Formbanset.frx":14FA
Key = ""
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Formbanset.frx":1604
Key = ""
EndProperty
EndProperty
End
Begin VB.Label Label9
Caption = "班别类型"
Height = 255
Left = 3600
TabIndex = 17
Top = 840
Width = 855
End
Begin VB.Label Label8
Caption = "名称"
Height = 255
Left = 2280
TabIndex = 14
Top = 855
Width = 375
End
Begin VB.Label Label7
Caption = "班别编号"
Height = 255
Left = 600
TabIndex = 13
Top = 855
Width = 735
End
Begin VB.Label Label6
Caption = "分"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 5520
TabIndex = 10
Top = 1200
Width = 255
End
Begin VB.Label Label5
Caption = "点"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 4680
TabIndex = 9
Top = 1200
Width = 255
End
Begin VB.Label Label4
Caption = "分"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 2520
TabIndex = 8
Top = 1200
Width = 255
End
Begin VB.Label Label3
Caption = "点"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 1800
TabIndex = 7
Top = 1200
Width = 255
End
Begin VB.Label Label2
Caption = "结束时间"
Height = 255
Left = 3480
TabIndex = 2
Top = 1200
Width = 735
End
Begin VB.Label label1
Caption = "开始时间"
Height = 255
Left = 600
TabIndex = 1
Top = 1200
Width = 735
End
End
Attribute VB_Name = "Formbanset"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim vbookmark As Variant
Dim lcurrrec As Long
Dim baddnewflag As Boolean
Dim WithEvents adors As Recordset
Attribute adors.VB_VarHelpID = -1
Dim vmbmid, vmbmname As String
Private Sub setbuttons(bval As Boolean)
Toolbar1.Buttons(1).Enabled = bval
Toolbar1.Buttons(2).Enabled = bval
Toolbar1.Buttons(3).Enabled = bval
End Sub
Private Sub Adcbset_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
If Not Adcbset.Recordset.EOF Then
Text5.Text = Adcbset.Recordset.Fields("bid").Value
Text6.Text = Adcbset.Recordset.Fields("bname").Value
Text1.Text = Adcbset.Recordset.Fields("bstarth").Value
Text2.Text = Adcbset.Recordset.Fields("bstartm").Value
Text3.Text = Adcbset.Recordset.Fields("bendh").Value
Text4.Text = Adcbset.Recordset.Fields("bendm").Value
Txtbanlname.Text = Adcbset.Recordset.Fields("banlid").Value
End If
End Sub
Private Sub Command1_Click()
Dialogbanl1.Show
End Sub
Private Sub DataGrid1_Change()
Toolbar1.Buttons(3).Enabled = True
End Sub
Private Sub Form_Load()
Toolbar1.Buttons(4).Enabled = False
Set adors = Adcbset.Recordset
If Not adors.EOF Then
Text1.Text = adors.Fields("bstarth").Value
Text2.Text = adors.Fields("bstartm").Value
Text3.Text = adors.Fields("bendh").Value
Text4.Text = adors.Fields("bendm").Value
Text5.Text = adors.Fields("bid").Value
Text6.Text = adors.Fields("bname").Value
Txtbanlname.Text = adors.Fields("banlid").Value
End If
DG1.Columns(0).Caption = "编号"
DG1.Columns(1).Caption = "班别名"
DG1.Columns(2).Caption = "上班时"
DG1.Columns(3).Caption = "上班分"
DG1.Columns(4).Visible = False
DG1.Columns(5).Caption = "下班时"
DG1.Columns(6).Caption = "下班分"
DG1.Columns(7).Visible = False
DG1.Columns(8).Caption = "班别类型"
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Dim response, vstarth, vstartm, vendh, vendm
Dim iresponse As Integer
With adors
Select Case Button.Index
Case 1
If Not (.BOF And .EOF) Then
vbookmark = .Bookmark
End If
.AddNew
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Txtbanlname.Text = ""
Text1.SetFocus
baddnewflag = True
setbuttons False
Toolbar1.Buttons(4).Enabled = True
Toolbar1.Buttons(5).Enabled = False
Case 2
response = MsgBox("Are you sure", vbYesNo, "delete record")
If response = vbYes Then
.Delete
.MoveNext
End If
If Adcbset.Recordset.EOF Then
lcurrrec = .RecordCount
.MoveLast
End If
Case 3
.Requery
Toolbar1.Buttons(4).Enabled = False
Case 4
response = MsgBox("你确信要更新", vbYesNo, "更新数据")
If response = vbYes Then
vstarth = Val(Text1.Text)
vstartm = Val(Text2.Text)
vendh = Val(Text3.Text)
vendm = Val(Text4.Text)
.Fields("bstarth").Value = Val(Text1.Text)
.Fields("bstartm").Value = Val(Text2.Text)
.Fields("bstime").Value = vstarth * 60 + vstartm
.Fields("bendh").Value = Val(Text3.Text)
.Fields("bendm").Value = Val(Text4.Text)
.Fields("bendtime").Value = vendh * 60 + vendm
.Fields("bid").Value = Text5.Text
.Fields("bname").Value = Text6.Text
.Fields("banlid").Value = Textbanlid.Text
.UpdateBatch
lcurrrec = .RecordCount
.MoveLast
End If
setbuttons True
Toolbar1.Buttons(5).Enabled = True
Toolbar1.Buttons(4).Enabled = False
Case 5
response = MsgBox("你确信取消操作", vbYesNo, "取消操作")
If response = vbYes Then
.CancelUpdate
End If
If vbookmark > 0 Then
.Bookmark = vbookmark
Else
lcurrrec = 1
.MoveFirst
Toolbar1.Buttons(4).Enabled = False
baddnewflag = False
End If
Case 6
If Toolbar1.Buttons(4).Enabled Then
iresponse = MsgBox("data changed ,save it?", vbYesNo, "update data?")
If iresponse = vbYes Then
adors.UpdateBatch adAffectAll
Else
adors.CancelUpdate
End If
End If
adors.Close
Unload Me
Case 7
Toolbar1.Buttons(4).Enabled = True
End Select
End With
End Sub
Private Sub Txtbanlname_Change()
Dim vbanlid, vbanlname As String
vbanlid = Txtbanlname.Text
Adcbanl.RecordSource = "select * from tbanl where banlid ='" & vbanlid & "'"
Adcbanl.Refresh
If Not Adcbanl.Recordset.EOF Then
vbanlname = Adcbanl.Recordset.Fields("banlname").Value
Txtbanlname.Text = vbanlname
Textbanlid.Text = vbanlid
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -