測試成塊的數據讀取
#Region "測試成塊的數據讀取"
    Private Sub btn_ReadDeviceBlock2_Click(sender As Object, e As EventArgs) Handles btn_ReadDeviceBlock2.Click
      Dim iReturnCode As Integer              'Return code
        Dim szDeviceName As String = ""         'List data for 'DeviceName'
        Dim iNumberOfDeviceName As Integer = 0  'Data for 'DeviceSize'
        Dim sharrDeviceValue() As Short         'Data for 'DeviceValue'
        Dim szarrData() As String               'Array for 'Data'
        Dim iNumber As Integer                  'Loop counter
        'Displayed output data is cleared.
        ClearDisplay()
        'Get the list of 'DeviceName'.
        '  Join each line(StringType array) of 'DeviceName' by the separator '\n',
        '  and create a joined string data.
        szDeviceName = String.Join(vbLf, txt_DeviceNameBlock.Lines)
        'Check the 'DeviceSize'.(If succeeded, the value is gotten.)
        If GetIntValue(txt_DeviceSizeBlock, iNumberOfDeviceName) = False Then
            'If failed, this process is end.
            Exit Sub
        End If
        'Assign the array for 'DeviceValue'.
        ReDim sharrDeviceValue(iNumberOfDeviceName - 1)
        Try
            iReturnCode = AxActUtlType1.ReadDeviceBlock2(szDeviceName, iNumberOfDeviceName, sharrDeviceValue(0))
        Catch exException As Exception
            MessageBox.Show(exException.Message, Name, MessageBoxButtons.OK, MessageBoxIcon.Error)
            Exit Sub
        End Try
        txt_ReturnCode.Text = String.Format("0x{0:x8} [HEX]", iReturnCode)
        If iReturnCode = 0 Then
            'Assign array for the read data.
            ReDim szarrData(iNumberOfDeviceName - 1)
            'Copy the read data to the 'lpszarrData'.
            For iNumber = 0 To iNumberOfDeviceName - 1
                szarrData(iNumber) = sharrDeviceValue(iNumber).ToString()
            Next iNumber
            'Set the read data to the 'Data', and display it.
            txt_Data.Lines = szarrData
        End If
    End Sub
#End Region 
