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

📄 form4.frm

📁 visual basic platform for data aquisition
💻 FRM
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form Form1 
   BackColor       =   &H00008000&
   Caption         =   "Loadshedding Settings"
   ClientHeight    =   4335
   ClientLeft      =   -90
   ClientTop       =   6795
   ClientWidth     =   9600
   LinkTopic       =   "Form1"
   ScaleHeight     =   4335
   ScaleWidth      =   9600
   Begin VB.Timer Timer2 
      Enabled         =   0   'False
      Interval        =   700
      Left            =   600
      Top             =   120
   End
   Begin VB.CommandButton Command2 
      Caption         =   "START RELAY 2"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   975
      Left            =   6000
      TabIndex        =   9
      Top             =   3120
      Width           =   2655
   End
   Begin VB.CommandButton Command1 
      Caption         =   "START RELAY 1"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   975
      Left            =   1680
      TabIndex        =   8
      Top             =   3120
      Width           =   2655
   End
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Interval        =   700
      Left            =   120
      Top             =   120
   End
   Begin MSComCtl2.DTPicker dt1 
      Height          =   375
      Left            =   3000
      TabIndex        =   1
      Top             =   1320
      Width           =   1335
      _ExtentX        =   2355
      _ExtentY        =   661
      _Version        =   393216
      Format          =   20774914
      CurrentDate     =   39534
   End
   Begin MSComCtl2.DTPicker dt2 
      Height          =   375
      Left            =   3000
      TabIndex        =   0
      Top             =   2040
      Width           =   1335
      _ExtentX        =   2355
      _ExtentY        =   661
      _Version        =   393216
      Format          =   20774914
      CurrentDate     =   39534
   End
   Begin MSComCtl2.DTPicker dt4 
      Height          =   375
      Left            =   7320
      TabIndex        =   4
      Top             =   2040
      Width           =   1335
      _ExtentX        =   2355
      _ExtentY        =   661
      _Version        =   393216
      Format          =   20774914
      CurrentDate     =   39534
   End
   Begin MSComCtl2.DTPicker dt3 
      Height          =   375
      Left            =   7320
      TabIndex        =   5
      Top             =   1320
      Width           =   1335
      _ExtentX        =   2355
      _ExtentY        =   661
      _Version        =   393216
      Format          =   20774914
      CurrentDate     =   39534
   End
   Begin VB.Label Label4 
      BackStyle       =   0  'Transparent
      Caption         =   "Relay 2 - Load Shed end time"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FFFFFF&
      Height          =   495
      Left            =   5280
      TabIndex        =   7
      Top             =   2040
      Width           =   1815
   End
   Begin VB.Label Label3 
      BackStyle       =   0  'Transparent
      Caption         =   "Relay 1 - Load Shed end time"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FFFFFF&
      Height          =   495
      Left            =   960
      TabIndex        =   6
      Top             =   2040
      Width           =   1815
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "Relay 2 - Load Shed start time"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FFFFFF&
      Height          =   495
      Left            =   5280
      TabIndex        =   3
      Top             =   1320
      Width           =   1815
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "Relay 1 - Load Shed start time"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FFFFFF&
      Height          =   495
      Left            =   960
      TabIndex        =   2
      Top             =   1320
      Width           =   1815
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim flag1, flag2, flag3, flag4
Dim ctim

Private Sub Command1_Click()
    If Timer1.Enabled = False Then
        Command1.Caption = "STOP RELAY 1"
        Timer1.Enabled = True
    ElseIf Timer1.Enabled = True Then
        Command1.Caption = "START RELAY 1"
        Timer1.Enabled = False
    End If
End Sub

Private Sub Command2_Click()
    If Timer2.Enabled = False Then
        Command2.Caption = "STOP RELAY 2"
        Timer2.Enabled = True
    ElseIf Timer2.Enabled = True Then
        Command2.Caption = "START RELAY 2"
        Timer2.Enabled = False
    End If
End Sub

Private Sub dt1_Change()
    flag1 = 0
End Sub

Private Sub dt2_Change()
    flag2 = 0
End Sub

Private Sub dt3_Change()
    flag3 = 0
End Sub

Private Sub dt4_Change()
    flag4 = 0
End Sub

Private Sub Form_Load()
    flag1 = 0
    flag2 = 0
    flag3 = 0
    flag4 = 0
 End Sub

Private Sub Timer1_Timer()
    'ctim = Format(Time, "hh:mm am/pm")
    If (Format(dt1, "hh:mm am/pm") = Format(Time, "hh:mm am/pm")) And flag1 = 0 Then
        flag1 = 1
        main.MSComm1.Output = "B"
    Else
    
    End If
    If (Format(dt2, "hh:mm am/pm") = Format(Time, "hh:mm am/pm")) And flag2 = 0 Then
        flag2 = 1
        main.MSComm1.Output = "A"
    Else
    
    End If
    
End Sub

Private Sub Timer2_Timer()
    If (Format(dt3, "hh:mm am/pm") = Format(Time, "hh:mm am/pm")) And flag3 = 0 Then
        flag3 = 1
        main.MSComm1.Output = "D"
    End If
    If (Format(dt4, "hh:mm am/pm") = Format(Time, "hh:mm am/pm")) And flag4 = 0 Then
        flag4 = 1
        main.MSComm1.Output = "C"
    End If
End Sub

⌨️ 快捷键说明

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