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

📄 frminput.frm

📁 本文档是基于UML的客户订购管理系统的设计
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00008080&
      Height          =   285
      Left            =   1080
      TabIndex        =   12
      Top             =   240
      Width           =   1590
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "用户职务:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00008080&
      Height          =   240
      Left            =   600
      TabIndex        =   3
      Top             =   2280
      Width           =   1080
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "用户口令:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00008080&
      Height          =   240
      Left            =   600
      TabIndex        =   2
      Top             =   1800
      Width           =   1080
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "用户名称:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00008080&
      Height          =   240
      Left            =   600
      TabIndex        =   1
      Top             =   1320
      Width           =   1080
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "用户编号:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00008080&
      Height          =   240
      Left            =   600
      TabIndex        =   0
      Top             =   840
      Width           =   1080
   End
End
Attribute VB_Name = "frmInput"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
    Option Explicit
    Dim Cnt As ADODB.Recordset
    Dim Cntr As String
    Dim cnte As Boolean
    
Private Sub cmdAdd_Click()
    SkyText
    FillText1
    Text1(0).SetFocus
    cmdSet.Enabled = False
    cmdAdd.Enabled = False
    cmdDel.Enabled = False
    cmdCancel.Enabled = True
    cmdSave.Enabled = True
    cnte = True
End Sub

Private Sub cmdCancel_Click()
    FillText2
    FillText
    cmdSet.Enabled = True
    cmdAdd.Enabled = True
    cmdDel.Enabled = True
    cmdCancel.Enabled = False
    cmdSave.Enabled = False
End Sub

Private Sub cmdDel_Click()
    If Cnt.RecordCount <= 0 Then Exit Sub
    If MsgBox("确实要删除所选记录吗?", vbYesNo + vbQuestion, "记录删除") = vbYes Then
        Cnt.Delete
        Cnt.Update
        Cnt.MoveFirst
        FillText
        frmInput.Refresh
    Else
        Exit Sub
    End If
End Sub

Private Sub cmdExit_Click()
    Unload Me
End Sub

Private Sub cmdFrist_Click()
    If Cnt.RecordCount <= 0 Then Exit Sub
    Cnt.MoveFirst
    FillText
End Sub

Private Sub cmdLast_Click()
    If Cnt.RecordCount <= 0 Then Exit Sub
    Cnt.MoveLast
    FillText
End Sub

Private Sub cmdNext_Click()
    If Cnt.RecordCount <= 0 Then Exit Sub
    Cnt.MoveNext
    If Cnt.EOF = True Then
        Cnt.MoveLast
        MsgBox "记录已经到底!", vbOKOnly + vbExclamation, "记录检查"
    End If
    FillText
End Sub

Private Sub cmdPriv_Click()
    If Cnt.RecordCount <= 0 Then Exit Sub
    Cnt.MovePrevious
    If Cnt.BOF = True Then
        Cnt.MoveFirst
        MsgBox "记录已经到头!", vbOKOnly + vbExclamation, "记录检查"
    End If
    FillText
End Sub

Private Sub cmdSave_Click()
    If Text1(0).Text = "" Then
        MsgBox "编号不容许为空,请认真填写!", vbOKOnly + vbExclamation, "字段检查"
        Text1(0).SetFocus
        Cnt.CancelUpdate
        Exit Sub
    ElseIf Text1(1).Text = "" Then
        MsgBox "用户名不容许为空,请认真填写!", vbOKOnly + vbExclamation, "字段检查"
        Text1(1).SetFocus
        Cnt.CancelUpdate
        Exit Sub
    ElseIf Text1(2).Text = "" Then
        MsgBox "密码不容许为空,请认真填写!", vbOKOnly + vbExclamation, "字段检查"
        Text1(2).SetFocus
        Cnt.CancelUpdate
        Exit Sub
    End If

    If cnte = True Then
        Cnt.AddNew
        FillRecordset1
        cnte = False
    Else
        FillRecordset
    End If
    Cnt.MoveFirst
    FillText
    FillText2
    cmdSet.Enabled = True
    cmdAdd.Enabled = True
    cmdDel.Enabled = True
    cmdCancel.Enabled = False
    cmdSave.Enabled = False
End Sub

Private Sub cmdSet_Click()
    FillText1
    Text1(0).SetFocus
    cmdSet.Enabled = False
    cmdAdd.Enabled = False
    cmdDel.Enabled = False
    cmdCancel.Enabled = True
    cmdSave.Enabled = True
End Sub

Private Sub Form_Load()
    Set Cnt = New Recordset
    
    Cntr = "Select * From UserMsg"
    Cnt.Open Cntr, cnStr, adOpenKeyset, adLockOptimistic, adCmdText
    
    FillText
    
    cnte = False
    
    Combo1.AddItem "职员"
    Combo1.AddItem "经理"
    frmInput.Width = 3855
    frmInput.Height = 4260
End Sub

Private Sub FillText()
    If Cnt.RecordCount <= 0 Then Exit Sub
    Dim i As Integer
    For i = 0 To 2
        Text1(i) = Cnt(i)
    Next
    Combo1.Text = Cnt(3)
End Sub

Private Sub FillText1()
    Dim i As Integer
    For i = 0 To 2
        Text1(i).Enabled = True
    Next
    Combo1.Enabled = True
End Sub

Private Sub FillText2()
    Dim i As Integer
    For i = 0 To 2
        Text1(i).Enabled = False
    Next
    Combo1.Enabled = False
End Sub

Private Sub SkyText()
    Dim i As Integer
    For i = 0 To 2
        Text1(i).Text = ""
    Next
    Combo1.Text = ""
End Sub

Private Sub FillRecordset()
    Dim i As Integer
    For i = 0 To 2
        Cnt(i) = Text1(i)
    Next
    Cnt(3) = Combo1.Text
    Cnt.UpdateBatch
End Sub
Private Sub FillRecordset1()
    Dim i As Integer
    For i = 0 To 2
        Cnt(i) = Text1(i)
    Next
    Cnt(3) = Combo1.Text
    Cnt.Update
End Sub

⌨️ 快捷键说明

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