📄 dialogset.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form Dialogset
BorderStyle = 3 'Fixed Dialog
Caption = "单位设置"
ClientHeight = 4620
ClientLeft = 2760
ClientTop = 3750
ClientWidth = 6375
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4620
ScaleWidth = 6375
ShowInTaskbar = 0 'False
Begin MSAdodcLib.Adodc Adodc2
Height = 330
Left = 2760
Top = 3840
Visible = 0 'False
Width = 1335
_ExtentX = 2355
_ExtentY = 582
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 = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=gonsi;Data Source=SERVER"
OLEDBString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=gonsi;Data Source=SERVER"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc2"
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.TextBox Textmoney
Height = 270
Left = 3840
TabIndex = 11
Top = 240
Width = 735
End
Begin VB.TextBox Textdv
Height = 270
Left = 2160
TabIndex = 9
Top = 240
Width = 855
End
Begin VB.TextBox Textdvid
Height = 270
Left = 840
TabIndex = 7
Top = 240
Width = 735
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "Dialogset.frx":0000
Height = 3015
Left = 480
TabIndex = 5
Top = 720
Width = 3495
_ExtentX = 6165
_ExtentY = 5318
_Version = 393216
HeadLines = 1
RowHeight = 15
FormatLocked = -1 'True
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 3
BeginProperty Column00
DataField = "dvid"
Caption = "编号"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = "dv"
Caption = "单位"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column02
DataField = "money"
Caption = "工资定额"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
ColumnWidth = 959.811
EndProperty
BeginProperty Column01
ColumnWidth = 929.764
EndProperty
BeginProperty Column02
ColumnWidth = 1140.095
EndProperty
EndProperty
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 600
Top = 3840
Visible = 0 'False
Width = 1815
_ExtentX = 3201
_ExtentY = 582
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 = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=gonsi;Data Source=SERVER"
OLEDBString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=gonsi;Data Source=SERVER"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "dv"
Caption = "Adodc1"
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 Cmdaction
Caption = "删除"
Height = 375
Index = 1
Left = 4440
TabIndex = 4
Top = 1440
Width = 735
End
Begin VB.CommandButton Cmdaction
Caption = "刷新"
Height = 375
Index = 2
Left = 4440
TabIndex = 3
Top = 1920
Width = 735
End
Begin VB.CommandButton Cmdaction
Caption = "保存"
Enabled = 0 'False
Height = 375
Index = 3
Left = 4440
TabIndex = 2
Top = 2400
Width = 735
End
Begin VB.CommandButton Cmdaction
Caption = "退出"
Height = 375
Index = 4
Left = 4440
TabIndex = 1
Top = 2880
Width = 735
End
Begin VB.CommandButton Cmdaction
Caption = "增加"
Height = 375
Index = 0
Left = 4440
TabIndex = 0
Top = 960
Width = 735
End
Begin VB.Label Label3
Caption = "工时定额"
Height = 255
Left = 3120
TabIndex = 10
Top = 240
Width = 855
End
Begin VB.Label Label2
Caption = "单位"
Height = 255
Left = 1800
TabIndex = 8
Top = 240
Width = 375
End
Begin VB.Label Label1
Caption = "编号"
Height = 375
Left = 480
TabIndex = 6
Top = 240
Width = 495
End
End
Attribute VB_Name = "Dialogset"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim response As Boolean
Dim vdvid As String
Private Sub Adodc1_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
If Not Adodc1.Recordset.EOF And Not Adodc1.Recordset.BOF Then
If Not IsNull(Adodc1.Recordset.Fields("dvid").Value) Then
Textdvid.Text = Adodc1.Recordset.Fields("dvid").Value
Else
Textdvid.Text = ""
End If
If Not IsNull(Adodc1.Recordset.Fields("dv").Value) Then
Textdv.Text = Adodc1.Recordset.Fields("dv").Value
Else
Textdv.Text = ""
End If
If Not IsNull(Adodc1.Recordset.Fields("money").Value) Then
Textmoney.Text = Adodc1.Recordset.Fields("money").Value
Else
Textmoney.Text = ""
End If
End If
End Sub
Private Sub Cmdaction_Click(Index As Integer)
Select Case Index
Case 0
Adodc1.Recordset.AddNew
Textdvid.SetFocus
Cmdaction(3).Enabled = True
setbuttons False
Case 1
response = MsgBox("你确定要删除记录?", vbOKCancel, "删除")
If response = True Then
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
End If
Case 2
Adodc1.RecordSource = "select * from dv where dvid<>''"
Adodc1.Refresh
Case 3
vdvid = Textdvid.Text
Adodc2.RecordSource = "select * from dv where dvid='" & vdvid & "'"
Adodc2.Refresh
If Adodc2.Recordset.EOF Then
Adodc1.Recordset.Fields("dv").Value = Textdv.Text
Adodc1.Recordset.Fields("dvid").Value = Textdvid.Text
Adodc1.Recordset.Fields("money").Value = Textmoney.Text
Adodc1.Recordset.Update
setbuttons True
Else
MsgBox ("编号重复")
End If
Case 4
Unload Me
End Select
End Sub
Private Sub Form_Load()
Cmdaction(3).Enabled = False
Adodc1.RecordSource = "select * from dv where dvid<>''"
Adodc1.Refresh
If Not Adodc1.Recordset.EOF Then
If Not IsNull(Adodc1.Recordset.Fields("dvid").Value) Then
Textdvid.Text = Adodc1.Recordset.Fields("dvid").Value
Else
Textdvid.Text = ""
End If
If Not IsNull(Adodc1.Recordset.Fields("dv").Value) Then
Textdv.Text = Adodc1.Recordset.Fields("dv").Value
Else
Textdv.Text = ""
End If
If Not IsNull(Adodc1.Recordset.Fields("money").Value) Then
Textmoney.Text = Adodc1.Recordset.Fields("money").Value
Else
Textmoney.Text = ""
End If
End If
End Sub
Private Sub setbuttons(bval As Boolean)
Cmdaction(0).Enabled = bval
Cmdaction(1).Enabled = bval
Cmdaction(2).Enabled = bval
Cmdaction(4).Enabled = bval
End Sub
Private Sub Textdv_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Textmoney.SetFocus
End If
End Sub
Private Sub Textdvid_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Textdv.SetFocus
End If
End Sub
Private Sub Textmoney_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Cmdaction(3).SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -