📄 main_jbzl_public.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
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 main_jbzl_public
BorderStyle = 3 'Fixed Dialog
Caption = "Form1"
ClientHeight = 3825
ClientLeft = 45
ClientTop = 330
ClientWidth = 5565
Icon = "main_jbzl_public.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3825
ScaleWidth = 5565
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 270
Top = 2310
Visible = 0 'False
Width = 2040
_ExtentX = 3598
_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=db_manpowerinfo"
OLEDBString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_manpowerinfo"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
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 MSDataGridLib.DataGrid DataGrid1
Height = 2415
Left = 0
TabIndex = 2
Top = 1395
Width = 5520
_ExtentX = 9737
_ExtentY = 4260
_Version = 393216
AllowUpdate = 0 'False
HeadLines = 1
RowHeight = 15
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 = 1
BeginProperty Column00
DataField = ""
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
MarqueeStyle = 4
BeginProperty Column00
ColumnWidth = 4724.788
EndProperty
EndProperty
End
Begin MSComctlLib.ImageList ImageList1
Left = 0
Top = 2550
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 8
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "main_jbzl_public.frx":000C
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "main_jbzl_public.frx":08E6
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "main_jbzl_public.frx":11C0
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "main_jbzl_public.frx":1A9A
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "main_jbzl_public.frx":2774
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "main_jbzl_public.frx":304E
Key = ""
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "main_jbzl_public.frx":37C8
Key = ""
EndProperty
BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "main_jbzl_public.frx":44A2
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 795
Left = 0
TabIndex = 4
Top = 0
Width = 5565
_ExtentX = 9816
_ExtentY = 1402
ButtonWidth = 1138
ButtonHeight = 1349
Appearance = 1
Style = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 8
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = " 增加 "
Key = "add"
ImageIndex = 1
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "修改"
Key = "modify"
ImageIndex = 2
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "删除"
Key = "delete"
ImageIndex = 3
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "保存"
Key = "save"
ImageIndex = 4
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "取消"
Key = "cancel"
ImageIndex = 5
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "关闭"
Key = "close"
ImageIndex = 8
EndProperty
EndProperty
BorderStyle = 1
End
Begin VB.Frame Frame1
Height = 615
Left = 15
TabIndex = 0
Top = 765
Width = 5520
Begin VB.TextBox Text1
Height = 330
Index = 1
Left = 1260
Locked = -1 'True
TabIndex = 1
Top = 180
Width = 3405
End
Begin VB.Label Label1
Caption = "label1"
Height = 165
Left = 150
TabIndex = 3
Top = 255
Width = 1065
End
End
End
Attribute VB_Name = "main_jbzl_public"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs1 As New ADODB.Recordset
Public blnAdd As Boolean
Dim mybookmark
Sub tlbState(state As Boolean)
With Toolbar1
If state = True Then
.Buttons(1).Enabled = False
.Buttons(2).Enabled = False
.Buttons(3).Enabled = False
.Buttons(5).Enabled = True
.Buttons(6).Enabled = True
Else
.Buttons(1).Enabled = True
.Buttons(2).Enabled = True
.Buttons(3).Enabled = True
.Buttons(5).Enabled = False
.Buttons(6).Enabled = False
End If
End With
End Sub
Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
If Adodc1.Recordset.RecordCount > 0 Then
mybookmark = DataGrid1.Bookmark
Text1(1) = DataGrid1.Columns(1)
End If
End Sub
Private Sub Form_Activate()
If jbxxtb <> "" Then
Adodc1.CommandType = adCmdTable
Adodc1.RecordSource = jbxxtb
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
End If
End Sub
Private Sub Form_Load()
Me.Caption = text
tlbState False
Dim rs As New ADODB.Recordset
If jbxxtb <> "" Then
rs.Open jbxxtb, Cnn, adOpenKeyset, adLockOptimistic
Label1.Caption = rs.Fields(1).Name
rs.Close
End If
End Sub
Private Sub Text1_GotFocus(index As Integer)
Text1(index).BackColor = &HFFFF00
Text1(index).SelStart = 0
Text1(index).SelLength = Len(Text1(index))
End Sub
Private Sub Text1_LostFocus(index As Integer)
Text1(index).BackColor = &H80000005
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case "add"
blnAdd = True
tlbState True
Text1(1).Locked = False
Text1(1).SetFocus
Case "modify"
If Adodc1.Recordset.RecordCount > 0 Then
blnAdd = False
tlbState True
Text1(1).Locked = False
Else
MsgBox "系统没有要修改的数据!", , "提示窗口"
End If
Case "delete"
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.Delete
Adodc1.Refresh
Else
MsgBox "系统没有要删除的数据!", , "提示窗口"
End If
Case "save"
On Error GoTo SaveErr
If Text1(1).text = "" Then
MsgBox "系统不允许" & Label1 & "为空!", , "提示窗口"
Exit Sub
End If
If blnAdd = True Then
Cnn.Execute ("insert into " & jbxxtb & "(" & Trim(Label1) & ") values('" + Text1(1) + "')")
Adodc1.Refresh
tlbState False
Text1(1).Locked = True
Else
Cnn.Execute ("update " & jbxxtb & " set " & Trim(Label1) & "='" + Text1(1) + "'where " & Trim(Label1) & "='" + DataGrid1.Columns(1) + "'")
Adodc1.Refresh
DataGrid1.Bookmark = mybookmark
tlbState False
Text1(1).Locked = True
End If
Exit Sub
SaveErr:
MsgBox Err.Description
Case "cancel"
tlbState False
Text1(1).Locked = True
Case "close"
Unload Me
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -