form1.frm
来自「一个vb工资管理系统」· FRM 代码 · 共 284 行
FRM
284 行
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form Form1
Caption = "录入部门"
ClientHeight = 6495
ClientLeft = 60
ClientTop = 345
ClientWidth = 11400
Icon = "Form1.frx":0000
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 6495
ScaleWidth = 11400
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 495
Left = 1200
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 0
Visible = 0 'False
Width = 2055
End
Begin VB.Frame Frame3
Height = 735
Left = 960
TabIndex = 12
Top = 5640
Width = 9975
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "操作提示:"
Height = 180
Left = 240
TabIndex = 13
Top = 360
Width = 900
End
End
Begin VB.Frame Frame2
Caption = "现有部门情况"
Height = 4815
Left = 4320
TabIndex = 2
Top = 720
Width = 6615
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Bindings = "Form1.frx":0ABA
Height = 4095
Left = 120
TabIndex = 3
Top = 360
Width = 6375
_ExtentX = 11245
_ExtentY = 7223
_Version = 393216
AllowUserResizing= 3
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
End
Begin VB.Frame Frame1
Caption = "数据录入区"
Height = 4815
Left = 960
TabIndex = 1
Top = 720
Width = 3135
Begin VB.CommandButton Command4
Caption = "返回"
Height = 495
Left = 1680
TabIndex = 11
Top = 3960
Width = 1335
End
Begin VB.CommandButton Command3
Caption = "取消"
Height = 495
Left = 120
TabIndex = 10
Top = 3960
Width = 1335
End
Begin VB.CommandButton Command2
Caption = "确定"
Enabled = 0 'False
Height = 495
Left = 1680
TabIndex = 9
Top = 3000
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "录入"
Height = 495
Left = 120
TabIndex = 8
Top = 3000
Width = 1335
End
Begin VB.TextBox Text2
Height = 375
Left = 1200
Locked = -1 'True
TabIndex = 7
Text = "Text2"
Top = 1680
Width = 1575
End
Begin VB.TextBox Text1
Height = 375
Left = 1200
Locked = -1 'True
TabIndex = 6
Text = "Text1"
Top = 720
Width = 1575
End
Begin VB.Line Line2
BorderColor = &H00FFFFFF&
X1 = -240
X2 = 2880
Y1 = 2655
Y2 = 2655
End
Begin VB.Line Line1
X1 = 0
X2 = 3120
Y1 = 2640
Y2 = 2640
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "部门名称:"
Height = 180
Left = 240
TabIndex = 5
Top = 1800
Width = 900
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "部门编号:"
Height = 180
Left = 240
TabIndex = 4
Top = 840
Width = 900
End
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "工资管理系统部门录入模块"
BeginProperty Font
Name = "隶书"
Size = 18
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 3720
TabIndex = 0
Top = 0
Width = 4500
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim d As Integer
Private Sub Command1_Click() '录入的单击事件
Command1.Enabled = False
Command2.Enabled = True
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
Text1.Locked = False
Text2.Locked = False
End Sub
Private Sub Command2_Click() '确定的单击事件
Call pd
If d = 222 Then
Data1.Recordset.AddNew
Data1.Recordset.Fields(0) = Text1.Text
Data1.Recordset.Fields(1) = Text2.Text
Data1.Recordset.Update
Data1.Refresh
Command1.Enabled = True
Command2.Enabled = False
Text1.Text = ""
Text1.Locked = True
Text2.Text = ""
Text2.Locked = True
Command1.SetFocus
End If
End Sub
Sub pd()
d = 222
Data1.Recordset.FindFirst "bmbh=" + "'" + Text1.Text + "'"
If Data1.Recordset.NoMatch = False Then
MsgBox "编号重复,请重新编号"
d = 123
Else
Data1.Recordset.FindFirst "bmmc=" + "'" + Text2.Text + "'"
If Data1.Recordset.NoMatch = False Then
MsgBox "此部门已经存在,请录入其他部门"
d = 123
End If
End If
End Sub
Private Sub Command3_Click() '取消的单击事件
Command1.Enabled = True
Command2.Enabled = False
Text1.Text = ""
Text2.Text = ""
Command1.SetFocus
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Form_Load()
Me.Top = 0
Me.Left = 0
Me.Height = gzglxt.Height - gzglxt.sb1.Height - 750 - gzglxt.Toolbar1.Height
Me.Width = gzglxt.Width - 180
'数据绑定
Data1.DatabaseName = "h:\vbxm\gzglxt.mdb"
Data1.RecordSource = "bmk"
Data1.Refresh
MSFlexGrid1.ColWidth(0) = 500
MSFlexGrid1.ColWidth(1) = 1900
MSFlexGrid1.ColWidth(2) = 3850
MSFlexGrid1.Row = 0
MSFlexGrid1.Col = 1
MSFlexGrid1.Text = "部门编号"
MSFlexGrid1.Row = 0
MSFlexGrid1.Col = 2
MSFlexGrid1.Text = "部门名称"
Label4.Caption = Label4.Caption + "单击录入按钮即可开始数据录入!!"
End Sub
Private Sub Label2_Click()
End Sub
Private Sub MSFlexGrid1_Click()
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If Len(Text1.Text) >= 1 Or KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command2.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?