jsrform.frm

来自「一套VB完整的灯具销售管理系统设计」· FRM 代码 · 共 249 行

FRM
249
字号
VERSION 5.00
Object = "{00028C01-0000-0000-0000-000000000046}#1.0#0"; "DBGRID32.OCX"
Begin VB.Form Jsrform1 
   AutoRedraw      =   -1  'True
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "经手人管理"
   ClientHeight    =   2940
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6255
   Icon            =   "jsrform.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2940
   ScaleWidth      =   6255
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton View 
      Caption         =   "查看密码"
      Height          =   330
      Left            =   5025
      TabIndex        =   9
      Top             =   315
      Width           =   990
   End
   Begin VB.CommandButton passButton 
      Caption         =   "密码(&K)"
      Enabled         =   0   'False
      Height          =   330
      Left            =   4095
      TabIndex        =   8
      Top             =   315
      Width           =   915
   End
   Begin VB.TextBox passwords 
      DataField       =   "密码"
      DataSource      =   "Jsrdata"
      Height          =   315
      Left            =   2460
      Locked          =   -1  'True
      TabIndex        =   7
      Top             =   3300
      Visible         =   0   'False
      Width           =   1485
   End
   Begin MSDBGrid.DBGrid DBGrid1 
      Bindings        =   "jsrform.frx":0442
      Height          =   1815
      Left            =   1710
      OleObjectBlob   =   "jsrform.frx":0454
      TabIndex        =   6
      Top             =   795
      Width           =   4290
   End
   Begin VB.Frame Frame1 
      Caption         =   "命令区域"
      Height          =   2385
      Left            =   270
      TabIndex        =   2
      Top             =   225
      Width           =   1350
      Begin VB.CommandButton jsrDelete 
         Caption         =   "删除经手人"
         Height          =   345
         Left            =   150
         TabIndex        =   5
         Top             =   1095
         Width           =   1050
      End
      Begin VB.CommandButton jsrAdd 
         Caption         =   "添加经手人"
         Default         =   -1  'True
         Height          =   345
         Left            =   150
         TabIndex        =   4
         Top             =   480
         Width           =   1050
      End
      Begin VB.CommandButton closeform 
         Cancel          =   -1  'True
         Caption         =   "退出(&X)"
         Height          =   345
         Left            =   150
         TabIndex        =   3
         Top             =   1695
         Width           =   1050
      End
   End
   Begin VB.TextBox Text1 
      DataField       =   "经手人"
      DataSource      =   "Jsrdata"
      Enabled         =   0   'False
      Height          =   315
      Left            =   3015
      Locked          =   -1  'True
      TabIndex        =   0
      Top             =   315
      Width           =   1095
   End
   Begin VB.Data Jsrdata 
      Caption         =   "Data1"
      Connect         =   "Access"
      DatabaseName    =   ""
      DefaultCursorType=   0  'DefaultCursor
      DefaultType     =   2  'UseODBC
      Exclusive       =   0   'False
      Height          =   285
      Left            =   330
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   ""
      Top             =   3315
      Visible         =   0   'False
      Width           =   1725
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "经手人:"
      Height          =   180
      Left            =   2085
      TabIndex        =   1
      Top             =   360
      Width           =   720
   End
End
Attribute VB_Name = "Jsrform1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub closeform_Click()
Unload Me
End Sub

Private Sub Form_Load()

jsrdata.DatabaseName = appData
jsrdata.RecordSource = "jsrk"

End Sub

Private Sub jsrAdd_Click()
  '保存新记录
  If jsrAdd.Caption = "保存" Then
     DBGrid1.Enabled = True
     passButton.Enabled = False
     jsrAdd.Caption = "添加经手人"
     jsrDelete.Caption = "删除经手人"
     CloseForm.Enabled = True
     Text1.Locked = True
     Text1.Enabled = False
     jsrdata.Refresh
       Exit Sub
   End If
   '添加新记录代码
jsrAdd.Caption = "保存"
jsrDelete.Caption = "放弃"
CloseForm.Enabled = False
passButton.Enabled = True
Text1.Enabled = True
Text1.Locked = False
DBGrid1.Enabled = False
Text1.SetFocus
jsrdata.Recordset.AddNew

End Sub

Private Sub jsrDelete_Click()
 '按钮为(放弃)时用代码
 If jsrDelete.Caption = "放弃" Then
    DBGrid1.Enabled = True
    passButton.Enabled = False
    jsrAdd.Caption = "添加经手人"
    jsrDelete.Caption = "删除经手人"
    CloseForm.Enabled = True
    Text1.Locked = True
    Text1.Enabled = False
    jsrdata.Recordset.CancelUpdate
    Exit Sub
    End If
    '以下为删除代码
  
  Dim db As Database, ef As Recordset, CountNum As Integer, xy As Integer
  Set db = OpenDatabase(appData)
  Set ef = db.OpenRecordset("jsrk", dbOpenTable)
  CountNum = ef.RecordCount
  If CountNum = 1 Then
     MsgBox "只有一个经手人了,拒绝删除!", vbOKOnly + 48, "下次吧?"
     Exit Sub
     Else
     xy = MsgBox("同意删除当前经手人( " & Trim(Text1.Text) & " )", 4 + 16, "确认删除")
      If xy = 6 Then
         jsrdata.Recordset.Delete
         jsrdata.Refresh
         Else
         Exit Sub
         End If
 End If
 End Sub

Private Sub passButton_Click()
Jsrform1.MousePointer = 11
Load passForm
Jsrform1.MousePointer = 0
passForm.Show 1
End Sub

Private Sub passwords_Change()
If Trim(passwords.Text) = "" Then
View.Enabled = False
Else
View.Enabled = True
End If
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
  If KeyAscii = 13 Then
   jsrAdd.SetFocus
   End If
   
   End Sub

Private Sub View_Click()
'解口令为可视
   Dim shiftStr As String, shiftStrL As String, shiftStrR As String, shiftNum As Integer, ili As Integer, TempStr As String, sureStr As String, Qy As Integer
      shiftStr = Trim(passwords.Text)
      shiftNum = Len(shiftStr)
      ili = 1
      sureStr = ""
      TempStr = ""
      Qy = 0
      For ili = shiftNum To 1 Step -3
        Qy = Qy + 1
        shiftStrR = Right(shiftStr, ili)
         If Qy / 2 = Int(Qy / 2) Then
           TempStr = ""
           Else
           shiftStrL = Left(shiftStrR, 3)
           TempStr = Chr(Val(shiftStrL))
             End If
            sureStr = sureStr & TempStr
                Next
  MsgBox "您的口令为:" & sureStr & "  ", vbOKOnly + 32, "显示口令"
 
End Sub

⌨️ 快捷键说明

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