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

📄 setuser1.frm

📁 一个用VB编写的小型图书管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form setuser1 
   Caption         =   "Form1"
   ClientHeight    =   2835
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   3825
   LinkTopic       =   "Form1"
   ScaleHeight     =   2835
   ScaleWidth      =   3825
   StartUpPosition =   3  '窗口缺省
   Begin VB.Frame Frame1 
      Caption         =   "用户编辑"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1815
      Left            =   600
      TabIndex        =   2
      Top             =   240
      Width           =   2775
      Begin VB.TextBox Text1 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   270
         Index           =   0
         Left            =   1200
         TabIndex        =   5
         Top             =   360
         Width           =   1095
      End
      Begin VB.TextBox Text1 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   270
         IMEMode         =   3  'DISABLE
         Index           =   1
         Left            =   1200
         PasswordChar    =   "*"
         TabIndex        =   4
         Top             =   840
         Width           =   1095
      End
      Begin VB.ComboBox Combo1 
         Height          =   300
         ItemData        =   "setuser1.frx":0000
         Left            =   1200
         List            =   "setuser1.frx":000A
         TabIndex        =   3
         Top             =   1320
         Width           =   1095
      End
      Begin VB.Label Label1 
         Caption         =   "用户名"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   480
         TabIndex        =   8
         Top             =   360
         Width           =   615
      End
      Begin VB.Label Label2 
         Caption         =   "口  令"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   480
         TabIndex        =   7
         Top             =   840
         Width           =   615
      End
      Begin VB.Label Label3 
         Caption         =   "用户级别"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   360
         TabIndex        =   6
         Top             =   1320
         Width           =   855
      End
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   960
      TabIndex        =   1
      Top             =   2280
      Width           =   735
   End
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2040
      TabIndex        =   0
      Top             =   2280
      Width           =   735
   End
End
Attribute VB_Name = "setuser1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cond As String

Private Sub Command1_Click()
If Trim(Text1(0).Text) = "" Or Trim(Text1(1).Text) = "" Or Trim(Combo1.Text) = "" Then
 MsgBox "数据项不全,请重新设置", vbOKOnly, "信息提示"
 Text1(0).SetFocus
 Exit Sub
End If
If flag = 1 Then
  If setuser.Adodc1.Recordset.RecordCount > 0 Then
  cond = "级别='" + Trim(Text1(0).Text) + "'"
  setuser.Adodc1.Recordset.MoveFirst
  setuser.Adodc1.Recordset.Find (cond)
  If Not setuser.Adodc1.Recordset.EOF() Then
    MsgBox "存在完全相同的记录", vbOKOnly, "信息提示"
    Text1(0).SetFocus
    Exit Sub
  End If
  End If
  setuser.Adodc1.Recordset.AddNew
  setuser.Adodc1.Recordset.Fields("用户名") = Trim(Text1(0).Text)
  setuser.Adodc1.Recordset.Fields("口令") = Val(Trim(Text1(1).Text))
  setuser.Adodc1.Recordset.Fields("级别") = Trim(Combo1.Text)
  setuser.Adodc1.Recordset.Update
  recs = recs + 1
Else
  n = setuser.Adodc1.Recordset.AbsolutePosition
  cond = "级别='" + Trim(Text1(0).Text) + "'"
  setuser.Adodc1.Recordset.MoveFirst
  setuser.Adodc1.Recordset.Find (cond)
  If Not setuser.Adodc1.Recordset.EOF() And setuser.Adodc1.Recordset.AbsolutePosition <> n Then
    MsgBox "存在完全相同的记录", vbOKOnly, "信息提示"
    setuser.Adodc1.Recordset.MoveFirst
    setuser.Adodc1.Recordset.Move (n - 1)
    Text1(0).SetFocus
    Exit Sub
  End If
  setuser.Adodc1.Recordset.MoveFirst
  setuser.Adodc1.Recordset.Move (n - 1)
  setuser.Adodc1.Recordset.Fields("用户名") = Trim(Text1(0).Text)
  setuser.Adodc1.Recordset.Fields("口令") = Val(Trim(Text1(1).Text))
  setuser.Adodc1.Recordset.Fields("级别") = Trim(Combo1.Text)
  setuser.Adodc1.Recordset.Update
 End If
 Unload Me
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Load()
If flag = 2 Then
  Text1(0).Text = setuser.Adodc1.Recordset.Fields("用户名")
  Text1(1).Text = setuser.Adodc1.Recordset.Fields("口令")
  Combo1.Text = setuser.Adodc1.Recordset.Fields("级别")
End If
End Sub


⌨️ 快捷键说明

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