⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frm_cksz.frm

📁 是一款专业的销售管理软件
💻 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"
Begin VB.Form frm_cksz 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "仓库设置"
   ClientHeight    =   4110
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6585
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4110
   ScaleWidth      =   6585
   ShowInTaskbar   =   0   'False
   Begin VB.TextBox Text10 
      DataField       =   "kname"
      DataSource      =   "Adodc1"
      Height          =   375
      Left            =   240
      TabIndex        =   14
      Top             =   4200
      Width           =   1095
   End
   Begin VB.Frame Frame1 
      Height          =   3210
      Left            =   30
      TabIndex        =   1
      Top             =   825
      Width           =   6480
      Begin MSAdodcLib.Adodc Adodc1 
         Height          =   330
         Left            =   1200
         Top             =   3240
         Visible         =   0   'False
         Width           =   4935
         _ExtentX        =   8705
         _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         =   ""
         OLEDBString     =   ""
         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 VB.TextBox Text6 
         Height          =   1455
         Left            =   1155
         TabIndex        =   13
         Top             =   1680
         Width           =   5130
      End
      Begin VB.TextBox Text5 
         Height          =   300
         Left            =   1155
         TabIndex        =   11
         Top             =   1320
         Width           =   5130
      End
      Begin VB.TextBox Text4 
         Height          =   300
         Left            =   1155
         TabIndex        =   9
         Top             =   960
         Width           =   5130
      End
      Begin VB.TextBox Text3 
         Height          =   300
         Left            =   3405
         TabIndex        =   7
         Top             =   600
         Width           =   2865
      End
      Begin VB.TextBox Text2 
         Height          =   300
         Left            =   1155
         TabIndex        =   5
         Top             =   600
         Width           =   1410
      End
      Begin VB.TextBox Text1 
         Height          =   300
         Left            =   1155
         TabIndex        =   3
         Top             =   240
         Width           =   5130
      End
      Begin MSComctlLib.ImageList ImageList1 
         Left            =   660
         Top             =   2370
         _ExtentX        =   1005
         _ExtentY        =   1005
         BackColor       =   -2147483643
         ImageWidth      =   26
         ImageHeight     =   26
         MaskColor       =   12632256
         _Version        =   393216
         BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
            NumListImages   =   4
            BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "frm_cksz.frx":0000
               Key             =   ""
            EndProperty
            BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "frm_cksz.frx":06CF
               Key             =   ""
            EndProperty
            BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "frm_cksz.frx":0E18
               Key             =   ""
            EndProperty
            BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "frm_cksz.frx":1509
               Key             =   ""
            EndProperty
         EndProperty
      End
      Begin VB.Label Label6 
         AutoSize        =   -1  'True
         Caption         =   "备注"
         Height          =   180
         Left            =   240
         TabIndex        =   12
         Top             =   1800
         Width           =   360
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "构建日期"
         Height          =   180
         Left            =   240
         TabIndex        =   10
         Top             =   1425
         Width           =   720
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "所属单位"
         Height          =   180
         Left            =   240
         TabIndex        =   8
         Top             =   1080
         Width           =   720
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "联系电话"
         Height          =   180
         Left            =   2595
         TabIndex        =   6
         Top             =   675
         Width           =   915
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "负责人"
         Height          =   180
         Left            =   240
         TabIndex        =   4
         Top             =   720
         Width           =   540
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "仓库名称"
         Height          =   180
         Left            =   240
         TabIndex        =   2
         Top             =   360
         Width           =   720
      End
   End
   Begin MSComctlLib.Toolbar Toolbar1 
      Align           =   1  'Align Top
      Height          =   765
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   6585
      _ExtentX        =   11615
      _ExtentY        =   1349
      ButtonWidth     =   1614
      ButtonHeight    =   1191
      Appearance      =   1
      ImageList       =   "ImageList1"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   4
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "  编 辑  "
            ImageIndex      =   1
         EndProperty
         BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "保 存"
            ImageIndex      =   2
         EndProperty
         BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "取 消"
            ImageIndex      =   3
         EndProperty
         BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "关 闭"
            ImageIndex      =   4
         EndProperty
      EndProperty
      BorderStyle     =   1
   End
End
Attribute VB_Name = "frm_cksz"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i

Private Sub Form_Load()
    rtn = SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 3)     '运用API函数SetWindowPos,来实现使窗体置前的功能

    '利用代码连接数据库
    Adodc1.ConnectionString = CnnStr
    Adodc1.RecordSource = "select * from tb_cksz"   '利用代码连接具体的数据表
    Adodc1.Refresh

    '使窗体居中
    Me.Left = (Screen.Width - Me.Width) / 2
    Me.Top = (Screen.Height - Me.Height) / 2

    If Adodc1.Recordset.RecordCount > 0 Then
        '将数据字段中的内容赋值到相对应的文本框当中
        Text1.Text = Adodc1.Recordset.Fields(1)
        Text2.Text = Adodc1.Recordset.Fields(2)
        Text3.Text = Adodc1.Recordset.Fields(3)
        Text4.Text = Adodc1.Recordset.Fields(4)
        Text5.Text = Adodc1.Recordset.Fields(5)
        Text6.Text = Adodc1.Recordset.Fields(6)
    End If
    Toolbar1.Buttons(1).Enabled = True    '使工具栏中的“编辑”按钮可用
    Toolbar1.Buttons(2).Enabled = False   '使工具栏中的“保存”按钮不可用
    Toolbar1.Buttons(3).Enabled = False   '使工具栏中的“取消”按钮不可用

    Text1.Enabled = False
    Text2.Enabled = False
    Text3.Enabled = False
    Text4.Enabled = False
    Text5.Enabled = False
    Text6.Enabled = False

End Sub

Private Sub Form_Unload(Cancel As Integer)
    Unload Me
    frm_main.Enabled = True
End Sub
'实现当光标落在文本框中时按下回车键的时候,光标移到下一个文本框当中
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then    '如果按下的是回车键,则光标落到文本框当中
        Text2.SetFocus
    End If
End Sub

Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then        '如果按下的是回车键,则光标落到文本框当中
        Text3.SetFocus
    End If
End Sub

Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then        '如果按下的是回车键,则光标落到文本框当中
        Text4.SetFocus
    End If
End Sub

Private Sub Text4_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
        Text5.SetFocus
    End If
End Sub

Private Sub Text5_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
        Text6.SetFocus
    End If
End Sub

Private Sub Text6_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then             '如果按下的是回车键,则光标落到文本框当中
        Text7.SetFocus
    End If
End Sub
Private Sub Text7_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
        Text8.SetFocus
    End If
End Sub
Private Sub Text8_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
        Text9.SetFocus
    End If
End Sub
'*** 单击“工具栏”的事件代码 ***
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
    Select Case Button.Index
    Case 1                       '单击“编辑”按钮
        Toolbar1.Buttons(1).Enabled = False
        Toolbar1.Buttons(2).Enabled = True
        Toolbar1.Buttons(3).Enabled = True
        '锁定相应的文本框
        Text1.Enabled = True
        Text2.Enabled = True
        Text3.Enabled = True
        Text4.Enabled = True
        Text5.Enabled = True
        Text6.Enabled = True

        Adodc1.RecordSource = "select * from tb_cksz where kname='" + Text1.Text + "'"
        Adodc1.Refresh
        If Adodc1.Recordset.RecordCount > 0 Then
            Text1.Text = Adodc1.Recordset.Fields(1)
            Text2.Text = Adodc1.Recordset.Fields(2)
            Text3.Text = Adodc1.Recordset.Fields(3)
            Text4.Text = Adodc1.Recordset.Fields(4)
            Text5.Text = Adodc1.Recordset.Fields(5)
            Text6.Text = Adodc1.Recordset.Fields(6)
        End If
    Case 2                         '单击“保存”按钮
        Call Main
        Adodc1.RecordSource = "select * from tb_cksz "
        Adodc1.Refresh
        If Adodc1.Recordset.RecordCount > 0 Then
            Adodc1.Recordset.Delete
        End If
        rtn = SetWindowPos(Me.hwnd, -2, 0, 0, 0, 0, 3)      '运用API函数SetWindowPos,来实现取消窗体置前的功能
        '应用SQL语句保存仓库设置的相关信息
        Set adoRs = adoCon.Execute("insert into tb_cksz values('1','" & Text1 & "','" & Text2 & "','" & Text3 & "','" & Text4 & "','" & Text5 & "','" & Text6 & "')")
        MsgBox "数据保存成功!!", 32
        adoCon.Close

        Text1.Enabled = False
        Text2.Enabled = False
        Text3.Enabled = False
        Text4.Enabled = False
        Text5.Enabled = False
        Text6.Enabled = False

        Toolbar1.Buttons(1).Enabled = True    '使工具栏中的“编辑”按钮可用
        Toolbar1.Buttons(2).Enabled = False   '使工具栏中的“保存”按钮不可用
        Toolbar1.Buttons(3).Enabled = False   '使工具栏中的“取消”按钮不可用

    Case 3                           '单击“取消”按钮
        Toolbar1.Buttons(1).Enabled = True
        Toolbar1.Buttons(2).Enabled = False
        Toolbar1.Buttons(3).Enabled = False
        Adodc1.RecordSource = "select * from tb_cksz where kname='" + Text1.Text + "'"
        Adodc1.Refresh
        If Adodc1.Recordset.RecordCount > 0 Then
            Text1.Text = Adodc1.Recordset.Fields(1)
            Text2.Text = Adodc1.Recordset.Fields(2)
            Text3.Text = Adodc1.Recordset.Fields(3)
            Text4.Text = Adodc1.Recordset.Fields(4)
            Text5.Text = Adodc1.Recordset.Fields(5)
            Text6.Text = Adodc1.Recordset.Fields(6)

            Text1.Enabled = False
            Text2.Enabled = False
            Text3.Enabled = False
            Text4.Enabled = False
            Text5.Enabled = False
            Text6.Enabled = False
        End If
    Case 4                           '单击“关闭”按钮
        Unload Me
    End Select
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -