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

📄 sampleform.frm

📁 vb通讯程序 vb 与三菱PLc的通讯程序源码
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Object = "{A306B14E-AE98-11D3-83AE-00A024BDBF2B}#3.0#0"; "ActPcCom.dll"
Object = "{A306B141-AE98-11D3-83AE-00A024BDBF2B}#3.0#0"; "ActMulti.dll"
Begin VB.Form SampleForm 
   Caption         =   "Sample"
   ClientHeight    =   6795
   ClientLeft      =   1065
   ClientTop       =   1350
   ClientWidth     =   6885
   BeginProperty Font 
      Name            =   "Arial"
      Size            =   9
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   ScaleHeight     =   6795
   ScaleWidth      =   6885
   StartUpPosition =   2  'CenterScreen
   Begin VB.Frame Frm_Output 
      Caption         =   "Output"
      Height          =   2295
      Left            =   120
      TabIndex        =   20
      Top             =   4800
      Width           =   6735
      Begin VB.ListBox Lst_Data 
         Height          =   1185
         Left            =   120
         TabIndex        =   13
         Top             =   960
         Width           =   6495
      End
      Begin VB.TextBox Txt_ReturnCode 
         Height          =   270
         IMEMode         =   3  'DISABLE
         Left            =   1440
         TabIndex        =   12
         Top             =   240
         Width           =   1500
      End
      Begin VB.Label Lbl_Data 
         Caption         =   "Data:"
         Height          =   255
         Index           =   6
         Left            =   120
         TabIndex        =   22
         Top             =   720
         Width           =   615
      End
      Begin VB.Label Lbl_ReturnCode 
         Caption         =   "ReturnCode:"
         Height          =   255
         Index           =   5
         Left            =   120
         TabIndex        =   21
         Top             =   240
         Width           =   1095
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "Input"
      Height          =   3495
      Left            =   120
      TabIndex        =   15
      Top             =   1200
      Width           =   3855
      Begin VB.TextBox Txt_DeviceData 
         Height          =   1000
         IMEMode         =   3  'DISABLE
         Left            =   2280
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   6
         Text            =   "SampleForm.frx":0000
         Top             =   2280
         Width           =   1500
      End
      Begin VB.TextBox Txt_DeviceName 
         Height          =   1000
         IMEMode         =   3  'DISABLE
         Left            =   2280
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   4
         Text            =   "SampleForm.frx":0010
         Top             =   720
         Width           =   1500
      End
      Begin VB.TextBox Txt_DeviceSize 
         Height          =   270
         IMEMode         =   3  'DISABLE
         Left            =   2280
         TabIndex        =   5
         Text            =   "5"
         Top             =   1800
         Width           =   1500
      End
      Begin VB.TextBox Txt_LogicalStationNumber 
         Height          =   270
         IMEMode         =   3  'DISABLE
         Left            =   2280
         TabIndex        =   3
         Text            =   "0"
         Top             =   240
         Width           =   1500
      End
      Begin VB.Label Lbl_DeviceData 
         Alignment       =   1  'Right Justify
         Caption         =   "DeviceData:"
         Height          =   255
         Left            =   120
         TabIndex        =   19
         Top             =   2280
         Width           =   1900
      End
      Begin VB.Label Lbl_DeviceSize 
         Alignment       =   1  'Right Justify
         Caption         =   "DeviceSize:"
         Height          =   255
         Left            =   120
         TabIndex        =   18
         Top             =   1800
         Width           =   1900
      End
      Begin VB.Label Label2 
         Alignment       =   1  'Right Justify
         Caption         =   "DeviceName:"
         Height          =   255
         Left            =   120
         TabIndex        =   17
         Top             =   720
         Width           =   1900
      End
      Begin VB.Label Lbl_LogicalStationNumber 
         Alignment       =   1  'Right Justify
         Caption         =   "LogicalStationNumber:"
         Height          =   255
         Left            =   120
         TabIndex        =   16
         Top             =   240
         Width           =   1900
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "Method"
      Height          =   3495
      Left            =   4200
      TabIndex        =   14
      Top             =   1200
      Width           =   2655
      Begin ACTMULTILibCtl.ActEasyIF ActEasyIF1 
         Left            =   1440
         OleObjectBlob   =   "SampleForm.frx":0025
         Top             =   2760
      End
      Begin ACTPCCOMLibCtl.ActACPU ActACPU1 
         Left            =   480
         OleObjectBlob   =   "SampleForm.frx":0057
         Top             =   2760
      End
      Begin VB.CommandButton Cmd_ReadDeviceRandom 
         Caption         =   "ReadDeviceRandom"
         Height          =   375
         Left            =   360
         TabIndex        =   10
         Top             =   1800
         Width           =   2055
      End
      Begin VB.CommandButton Cmd_WriteDeviceRandom 
         Caption         =   "WriteDeviceRandom"
         Height          =   375
         Left            =   360
         TabIndex        =   11
         Top             =   2280
         Width           =   2055
      End
      Begin VB.CommandButton Cmd_GetCpuType 
         Caption         =   "GetCpuType"
         Height          =   375
         Left            =   360
         TabIndex        =   9
         Top             =   1320
         Width           =   2055
      End
      Begin VB.CommandButton Cmd_Close 
         Caption         =   "Close"
         Height          =   375
         Left            =   360
         TabIndex        =   8
         Top             =   840
         Width           =   2055
      End
      Begin VB.CommandButton Cmd_Open 
         Caption         =   "Open"
         Height          =   375
         Left            =   360
         TabIndex        =   7
         Top             =   360
         Width           =   2055
      End
   End
   Begin VB.Frame Frm_Control 
      Caption         =   "Control"
      Height          =   975
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   6735
      Begin VB.OptionButton Opt_Control 
         Caption         =   "ActEasyIF (control for communicating set utility) "
         Height          =   255
         Index           =   0
         Left            =   240
         TabIndex        =   1
         Top             =   240
         Value           =   -1  'True
         Width           =   6375
      End
      Begin VB.OptionButton Opt_Control 
         Caption         =   "ActACPU (control for ACPU connection)"
         Height          =   255
         Index           =   1
         Left            =   240
         TabIndex        =   2
         Top             =   600
         Width           =   6375
      End
   End
End
Attribute VB_Name = "SampleForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit                         'All variables are declared clearly.

Const CONTROL_ACTEASYIF = 0
Const CONTROL_ACTACPU = 1
Const MSG_ERRDATA_LOGICAL_01 = "LogicalStationNumber is not input."
Const MSG_ERRDATA_LOGICAL_02 = "The input of a LogicalStationNumber is not correct."
Dim ControlIndex As Integer    'Use control
Dim ErrMsg As String            'Error message

'/****************************************************************************/
'/*  <SUB>   Cmd_Open_Click                                                  */
'/*  [[[Processing of Open button]]]                                         */
'/****************************************************************************/
Private Sub Cmd_Open_Click()
    Dim lRet As Long    'Return value.

    On Error GoTo Error 'Error Handler.

    'Displayed output data is cleared.
    Call ClsOutputData

    'Processing according to use control.
    Select Case ControlIndex
    Case CONTROL_ACTEASYIF
        'When you use control of ActEasyIF.
        'The input value of a LogicalStatioNumber is judged.
        If Txt_LogicalStationNumber.Text = "" Then
            MsgBox (MSG_ERRDATA_LOGICAL_01)
            Exit Sub
        Else
            'The input value of a LogicalStatioNumber is judged.
            If IsNumeric(Txt_LogicalStationNumber.Text) = False Then
                MsgBox (MSG_ERRDATA_LOGICAL_02)
                Exit Sub
            End If
        End If
        'The value of a LogicalStationNumber is set in the property.
        ActEasyIF1.ActLogicalStationNumber = CLng(Txt_LogicalStationNumber.Text)
                                            'Other properties use the default value.
        lRet = ActEasyIF1.Open              'The Open method is executed.
    Case CONTROL_ACTACPU
        'When you use control of ActACPU.
        'The value is set in the property.

⌨️ 快捷键说明

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