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

📄 frmaddwarn.frm

📁 客户关系管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomct2.ocx"
Begin VB.Form frmAddWarn 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "添加定时提醒"
   ClientHeight    =   3855
   ClientLeft      =   2760
   ClientTop       =   3750
   ClientWidth     =   6045
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3855
   ScaleWidth      =   6045
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton cmdModify 
      Caption         =   "修改"
      Height          =   375
      Left            =   240
      TabIndex        =   7
      Top             =   3240
      Width           =   1215
   End
   Begin VB.Frame fraWarn 
      Caption         =   "定时提醒设置"
      Height          =   2775
      Left            =   240
      TabIndex        =   2
      Top             =   240
      Width           =   5415
      Begin VB.TextBox txtWarnMsg 
         BackColor       =   &H80000009&
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1215
         Left            =   1320
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   4
         Top             =   1440
         Width           =   3735
      End
      Begin MSComCtl2.DTPicker dtpWarnDate 
         Height          =   375
         Left            =   1320
         TabIndex        =   3
         Top             =   840
         Width           =   3015
         _ExtentX        =   5318
         _ExtentY        =   661
         _Version        =   393216
         CalendarTitleBackColor=   -2147483635
         Format          =   23068673
         CurrentDate     =   38219
      End
      Begin VB.Label labWarnObj 
         Caption         =   "labWarnObj"
         Height          =   180
         Left            =   1320
         TabIndex        =   9
         Top             =   360
         Width           =   3015
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "提醒对象"
         Height          =   180
         Left            =   120
         TabIndex        =   8
         Top             =   360
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "提醒时间"
         Height          =   180
         Left            =   120
         TabIndex        =   6
         Top             =   840
         Width           =   720
      End
      Begin VB.Label Label2 
         Caption         =   "提醒内容"
         Height          =   255
         Left            =   120
         TabIndex        =   5
         Top             =   1440
         Width           =   855
      End
   End
   Begin VB.CommandButton CancelButton 
      Caption         =   "取消"
      Height          =   375
      Left            =   4440
      TabIndex        =   1
      Top             =   3240
      Width           =   1215
   End
   Begin VB.CommandButton OKButton 
      Caption         =   "确定"
      Height          =   375
      Left            =   3000
      TabIndex        =   0
      Top             =   3240
      Width           =   1215
   End
End
Attribute VB_Name = "frmAddWarn"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit

Private OK As Boolean         '确定用户按了OK还是CANCEL按钮
Private objWarn As cWarning
Public ViewType As gxcViewType
Private WarnTypeId As gxcWarnType

Private Sub CancelButton_Click()
  '按了取消按钮
  OK = False
  Me.Hide

End Sub

Private Sub cmdModify_Click()
  ViewType = vtModify
  SetStatus
End Sub

Private Sub OKButton_Click()
  OK = True
  '如果是新增状态,则新建立一个“人员”对象
  If ViewType = vtadd Then Set objWarn = New cWarning
  Call SaveValue
  Me.Hide

End Sub

'设置对话框状态
Private Sub SetStatus()
  '根据是“新增”还是修改,确定显示内容
  txtWarnMsg.Appearance = 1
  txtWarnMsg.BackColor = &H80000009
  txtWarnMsg.Locked = False
  cmdModify.Visible = False
  dtpWarnDate.Enabled = True
  
  '设置控件默认值
  Call SetDefaultValue
  
  Select Case ViewType
  Case vtadd    '添加提醒信息
    CancelButton.Visible = True
    OKButton.Caption = "确定"
    Me.Caption = "添加定时提醒"
  Case vtModify '修改提醒信息
    CancelButton.Visible = True
    OKButton.Caption = "保存"
    Me.Caption = "修改定时提醒"
  Case vtInfo   '查看提醒信息
    cmdModify.Visible = True
    CancelButton.Visible = False
    OKButton.Caption = "关闭"
    Me.Caption = "查看定时提醒"

    txtWarnMsg.Appearance = 0
    txtWarnMsg.BackColor = &H8000000F
    txtWarnMsg.Locked = True
    dtpWarnDate.Enabled = False
  End Select

End Sub

'打开对话框
Public Function RetriveWarn(ByRef oWarn As cWarning, ByVal eViewType As gxcViewType) As Boolean
  Set objWarn = oWarn
  
  ViewType = eViewType  '对话框状态
  
  SetStatus '根据新增或编辑状态设置显示内容
  
  OK = False
  Me.Show vbModal
  If OK = False Then Exit Function
  
  Set oWarn = objWarn
  RetriveWarn = True
  Unload Me
End Function

'设置默认值
Private Sub SetDefaultValue()
  Dim ctl As Control
  Dim i As Integer
 
  If objWarn Is Nothing Then
    For Each ctl In Controls
      If TypeOf ctl Is TextBox Then
        ctl.Text = ""
      End If
    Next
    WarnTypeId = CommonWarn
  Else
    With objWarn
      txtWarnMsg.Text = .Msg
      dtpWarnDate.Value = .ShowDate
      If .TypeId = BirthdayWarn Then
        ViewType = vtInfo
      End If
      labWarnObj.Caption = .ClientName
      WarnTypeId = .TypeId
    End With
  End If
  
End Sub

'检查输入有效性
Private Function CheckValid() As Boolean
  '检验是否输入了名字,或是否正确输入了年龄
  If Not IsDate(dtpWarnDate.Value) Then
    MsgBox "请输入合法日期"
    CheckValid = False
  End If
  If Trim(txtWarnMsg) = "" Then
    MsgBox "请输入提醒信息"
    CheckValid = True
  End If
End Function

'保存提醒对象
Private Sub SaveValue()
  
  '给“提醒”对象赋值
  With objWarn
    .Msg = txtWarnMsg
    .ShowDate = dtpWarnDate.Value
    .TypeId = WarnTypeId
  End With

End Sub

⌨️ 快捷键说明

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