main_jbzl_htlx.frm
上传用户:ake0106
上传日期:2022-07-23
资源大小:4052k
文件大小:14k
源码类别:

企业管理

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
  4. Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
  5. Begin VB.Form main_jbzl_htlx 
  6.    BorderStyle     =   3  'Fixed Dialog
  7.    Caption         =   "Form1"
  8.    ClientHeight    =   3945
  9.    ClientLeft      =   45
  10.    ClientTop       =   330
  11.    ClientWidth     =   8205
  12.    Icon            =   "main_jbzl_htlx.frx":0000
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   3945
  17.    ScaleWidth      =   8205
  18.    ShowInTaskbar   =   0   'False
  19.    StartUpPosition =   2  '屏幕中心
  20.    Begin MSComctlLib.ImageList ImageList1 
  21.       Left            =   -225
  22.       Top             =   2550
  23.       _ExtentX        =   1005
  24.       _ExtentY        =   1005
  25.       BackColor       =   -2147483643
  26.       ImageWidth      =   32
  27.       ImageHeight     =   32
  28.       MaskColor       =   12632256
  29.       _Version        =   393216
  30.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  31.          NumListImages   =   8
  32.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  33.             Picture         =   "main_jbzl_htlx.frx":000C
  34.             Key             =   ""
  35.          EndProperty
  36.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  37.             Picture         =   "main_jbzl_htlx.frx":08E6
  38.             Key             =   ""
  39.          EndProperty
  40.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  41.             Picture         =   "main_jbzl_htlx.frx":11C0
  42.             Key             =   ""
  43.          EndProperty
  44.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  45.             Picture         =   "main_jbzl_htlx.frx":1A9A
  46.             Key             =   ""
  47.          EndProperty
  48.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  49.             Picture         =   "main_jbzl_htlx.frx":2774
  50.             Key             =   ""
  51.          EndProperty
  52.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  53.             Picture         =   "main_jbzl_htlx.frx":304E
  54.             Key             =   ""
  55.          EndProperty
  56.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  57.             Picture         =   "main_jbzl_htlx.frx":37C8
  58.             Key             =   ""
  59.          EndProperty
  60.          BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  61.             Picture         =   "main_jbzl_htlx.frx":44A2
  62.             Key             =   ""
  63.          EndProperty
  64.       EndProperty
  65.    End
  66.    Begin MSAdodcLib.Adodc Adodc1 
  67.       Height          =   330
  68.       Left            =   15
  69.       Top             =   3120
  70.       Visible         =   0   'False
  71.       Width           =   2040
  72.       _ExtentX        =   3598
  73.       _ExtentY        =   582
  74.       ConnectMode     =   0
  75.       CursorLocation  =   3
  76.       IsolationLevel  =   -1
  77.       ConnectionTimeout=   15
  78.       CommandTimeout  =   30
  79.       CursorType      =   3
  80.       LockType        =   3
  81.       CommandType     =   2
  82.       CursorOptions   =   0
  83.       CacheSize       =   50
  84.       MaxRecords      =   0
  85.       BOFAction       =   0
  86.       EOFAction       =   0
  87.       ConnectStringType=   1
  88.       Appearance      =   1
  89.       BackColor       =   -2147483643
  90.       ForeColor       =   -2147483640
  91.       Orientation     =   0
  92.       Enabled         =   -1
  93.       Connect         =   "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_manpowerinfo"
  94.       OLEDBString     =   "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_manpowerinfo"
  95.       OLEDBFile       =   ""
  96.       DataSourceName  =   ""
  97.       OtherAttributes =   ""
  98.       UserName        =   ""
  99.       Password        =   ""
  100.       RecordSource    =   "合同类型表"
  101.       Caption         =   "Adodc1"
  102.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  103.          Name            =   "宋体"
  104.          Size            =   9
  105.          Charset         =   134
  106.          Weight          =   400
  107.          Underline       =   0   'False
  108.          Italic          =   0   'False
  109.          Strikethrough   =   0   'False
  110.       EndProperty
  111.       _Version        =   393216
  112.    End
  113.    Begin MSDataGridLib.DataGrid DataGrid1 
  114.       Bindings        =   "main_jbzl_htlx.frx":4D7C
  115.       Height          =   2505
  116.       Left            =   15
  117.       TabIndex        =   5
  118.       Top             =   1395
  119.       Width           =   8160
  120.       _ExtentX        =   14393
  121.       _ExtentY        =   4419
  122.       _Version        =   393216
  123.       AllowUpdate     =   0   'False
  124.       HeadLines       =   1
  125.       RowHeight       =   15
  126.       FormatLocked    =   -1  'True
  127.       BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  128.          Name            =   "宋体"
  129.          Size            =   9
  130.          Charset         =   134
  131.          Weight          =   400
  132.          Underline       =   0   'False
  133.          Italic          =   0   'False
  134.          Strikethrough   =   0   'False
  135.       EndProperty
  136.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  137.          Name            =   "宋体"
  138.          Size            =   9
  139.          Charset         =   134
  140.          Weight          =   400
  141.          Underline       =   0   'False
  142.          Italic          =   0   'False
  143.          Strikethrough   =   0   'False
  144.       EndProperty
  145.       ColumnCount     =   2
  146.       BeginProperty Column00 
  147.          DataField       =   "编号"
  148.          Caption         =   "编号"
  149.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  150.             Type            =   0
  151.             Format          =   ""
  152.             HaveTrueFalseNull=   0
  153.             FirstDayOfWeek  =   0
  154.             FirstWeekOfYear =   0
  155.             LCID            =   2052
  156.             SubFormatType   =   0
  157.          EndProperty
  158.       EndProperty
  159.       BeginProperty Column01 
  160.          DataField       =   "合同类型"
  161.          Caption         =   "合同类型"
  162.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  163.             Type            =   0
  164.             Format          =   ""
  165.             HaveTrueFalseNull=   0
  166.             FirstDayOfWeek  =   0
  167.             FirstWeekOfYear =   0
  168.             LCID            =   2052
  169.             SubFormatType   =   0
  170.          EndProperty
  171.       EndProperty
  172.       SplitCount      =   1
  173.       BeginProperty Split0 
  174.          MarqueeStyle    =   4
  175.          BeginProperty Column00 
  176.             ColumnWidth     =   1679.811
  177.          EndProperty
  178.          BeginProperty Column01 
  179.             ColumnWidth     =   5774.74
  180.          EndProperty
  181.       EndProperty
  182.    End
  183.    Begin MSComctlLib.Toolbar Toolbar1 
  184.       Align           =   1  'Align Top
  185.       Height          =   795
  186.       Left            =   0
  187.       TabIndex        =   0
  188.       Top             =   0
  189.       Width           =   8205
  190.       _ExtentX        =   14473
  191.       _ExtentY        =   1402
  192.       ButtonWidth     =   1138
  193.       ButtonHeight    =   1349
  194.       Appearance      =   1
  195.       Style           =   1
  196.       ImageList       =   "ImageList1"
  197.       _Version        =   393216
  198.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  199.          NumButtons      =   11
  200.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  201.             Caption         =   " 增加 "
  202.             Key             =   "add"
  203.             ImageIndex      =   1
  204.          EndProperty
  205.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  206.             Caption         =   "修改"
  207.             Key             =   "modify"
  208.             ImageIndex      =   2
  209.          EndProperty
  210.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  211.             Caption         =   "删除"
  212.             Key             =   "delete"
  213.             ImageIndex      =   3
  214.          EndProperty
  215.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  216.             Style           =   3
  217.          EndProperty
  218.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  219.             Caption         =   "保存"
  220.             Key             =   "save"
  221.             ImageIndex      =   4
  222.          EndProperty
  223.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  224.             Caption         =   "取消"
  225.             Key             =   "cancel"
  226.             ImageIndex      =   5
  227.          EndProperty
  228.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  229.             Style           =   3
  230.          EndProperty
  231.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  232.             Caption         =   "查找"
  233.             Key             =   "find"
  234.             ImageIndex      =   6
  235.          EndProperty
  236.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  237.             Caption         =   "全部"
  238.             Key             =   "all"
  239.             ImageIndex      =   7
  240.          EndProperty
  241.          BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  242.             Style           =   3
  243.          EndProperty
  244.          BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  245.             Caption         =   "关闭"
  246.             Key             =   "close"
  247.             ImageIndex      =   8
  248.          EndProperty
  249.       EndProperty
  250.       BorderStyle     =   1
  251.    End
  252.    Begin VB.Frame Frame1 
  253.       Height          =   585
  254.       Left            =   15
  255.       TabIndex        =   1
  256.       Top             =   765
  257.       Width           =   8175
  258.       Begin VB.TextBox Text1 
  259.          Height          =   330
  260.          Index           =   1
  261.          Left            =   3255
  262.          Locked          =   -1  'True
  263.          TabIndex        =   4
  264.          Top             =   165
  265.          Width           =   4815
  266.       End
  267.       Begin VB.TextBox Text1 
  268.          Height          =   330
  269.          Index           =   0
  270.          Left            =   480
  271.          Locked          =   -1  'True
  272.          TabIndex        =   3
  273.          Top             =   165
  274.          Width           =   1920
  275.       End
  276.       Begin VB.Label Label2 
  277.          Caption         =   "合同类型"
  278.          ForeColor       =   &H000000FF&
  279.          Height          =   165
  280.          Left            =   2475
  281.          TabIndex        =   6
  282.          Top             =   225
  283.          Width           =   975
  284.       End
  285.       Begin VB.Label Label1 
  286.          Caption         =   "编号"
  287.          ForeColor       =   &H000000FF&
  288.          Height          =   165
  289.          Left            =   75
  290.          TabIndex        =   2
  291.          Top             =   240
  292.          Width           =   435
  293.       End
  294.    End
  295. End
  296. Attribute VB_Name = "main_jbzl_htlx"
  297. Attribute VB_GlobalNameSpace = False
  298. Attribute VB_Creatable = False
  299. Attribute VB_PredeclaredId = True
  300. Attribute VB_Exposed = False
  301. Dim rs1 As New ADODB.Recordset
  302. Public blnAdd As Boolean
  303. Dim mybookmark
  304. Sub view_data()
  305.   Dim sdate, edate
  306.   Dim i As Integer
  307.   If Adodc1.Recordset.RecordCount > 0 Then
  308.   For i = 0 To 1
  309.     Text1(i) = DataGrid1.Columns(i).text
  310.   Next i
  311.   End If
  312. End Sub
  313. Sub tlbState(state As Boolean)
  314.   With Toolbar1
  315.     If state = True Then
  316.        .Buttons(1).Enabled = False
  317.        .Buttons(2).Enabled = False
  318.        .Buttons(3).Enabled = False
  319.        .Buttons(5).Enabled = True
  320.        .Buttons(6).Enabled = True
  321.        For i = 1 To Text1.UBound
  322.          Text1(i).Locked = False
  323.        Next i
  324.     Else
  325.        .Buttons(1).Enabled = True
  326.        .Buttons(2).Enabled = True
  327.        .Buttons(3).Enabled = True
  328.        .Buttons(5).Enabled = False
  329.        .Buttons(6).Enabled = False
  330.        For i = 1 To Text1.UBound
  331.          Text1(i).Locked = True
  332.        Next i
  333.      End If
  334.    End With
  335. End Sub
  336. Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
  337.   view_data
  338. End Sub
  339. Private Sub Form_Activate()
  340.   If sql <> "" Then
  341.      Adodc1.RecordSource = sql
  342.      Adodc1.Refresh
  343.      If Adodc1.Recordset.RecordCount > 0 Then
  344.         view_data
  345.      Else
  346.         MsgBox "没有找到符合条件的记录!", , "提示窗口"
  347.      End If
  348.   End If
  349. End Sub
  350. Private Sub Form_Load()
  351.   Me.Caption = text
  352.   tlbState False
  353. End Sub
  354. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  355.   sql = ""
  356. End Sub
  357. Private Sub Text1_GotFocus(Index As Integer)
  358.   Text1(Index).BackColor = &HFFFF00
  359.   Text1(Index).SelStart = 0
  360.   Text1(Index).SelLength = Len(Text1(Index))
  361. End Sub
  362. Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
  363.   If KeyCode = vbKeyReturn And Index < 1 Then Text1(Index + 1).SetFocus
  364. End Sub
  365. Private Sub Text1_LostFocus(Index As Integer)
  366.   Text1(Index).BackColor = &H80000005
  367. End Sub
  368. Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
  369.   Select Case Button.Key
  370.      Case "add"
  371.        blnAdd = True
  372.        tlbState True
  373.        rs1.Open "select * from 合同类型表", Cnn, adOpenStatic
  374.        If rs1.RecordCount > 0 Then
  375.           rs1.MoveLast
  376.           Text1(0) = Format(Val(rs1.Fields("编号")) + 1, "00")
  377.        Else
  378.           Text1(0) = "01"
  379.        End If
  380.        rs1.Close
  381.        For i = 1 To Text1.UBound
  382.            Text1(i) = ""
  383.        Next i
  384.        Text1(1).SetFocus
  385.      Case "modify"
  386.        If Adodc1.Recordset.RecordCount > 0 Then
  387.          blnAdd = False
  388.          tlbState True
  389.          view_data
  390.          mybookmark = DataGrid1.Bookmark
  391.        Else
  392.          MsgBox "系统没有要修改的数据!", , "提示窗口"
  393.        End If
  394.      Case "delete"
  395.        If Adodc1.Recordset.RecordCount > 0 Then
  396.          Adodc1.Recordset.Delete
  397.          Adodc1.Refresh
  398.        Else
  399.          MsgBox "系统没有要删除的数据!", , "提示窗口"
  400.        End If
  401.      Case "save"
  402.        On Error GoTo SaveErr
  403.         If blnAdd = True Then
  404.           Cnn.Execute ("insert into 合同类型表(编号,合同类型) values('" + Text1(0) + "','" + Text1(1) + "')")
  405.           Adodc1.Refresh
  406.           tlbState False
  407.         Else
  408.           Cnn.Execute ("update 合同类型表 set 合同类型 ='" + Text1(1) + "'where 编号='" + Text1(0) + "'")
  409.           Adodc1.Refresh
  410.           DataGrid1.Bookmark = mybookmark
  411.           view_data
  412.           tlbState False
  413.         End If
  414.         Exit Sub
  415. SaveErr:
  416.         MsgBox Err.Description
  417.      Case "cancel"
  418.        tlbState False
  419.      Case "find"
  420.        tb = "合同类型表"
  421.        Load main_find
  422.        main_find.Show 1
  423.      Case "all"
  424.        Adodc1.RecordSource = "合同类型表 order by 编号"
  425.        Adodc1.Refresh
  426.      Case "close"
  427.        Unload Me
  428.   End Select
  429. End Sub