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

📄 aoform.vb

📁 使用研华DAQ和VB.net实现研华数据采集卡的多种功能.包括数据输入输出。内含多个源码
💻 VB
📖 第 1 页 / 共 4 页
字号:
        Me.cmdOutputStart.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmdOutputStart.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.cmdOutputStart.ForeColor = System.Drawing.SystemColors.ControlText
        Me.cmdOutputStart.Location = New System.Drawing.Point(8, 25)
        Me.cmdOutputStart.Name = "cmdOutputStart"
        Me.cmdOutputStart.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.cmdOutputStart.Size = New System.Drawing.Size(73, 25)
        Me.cmdOutputStart.TabIndex = 22
        Me.cmdOutputStart.Text = "St&art"
        Me.ToolTip1.SetToolTip(Me.cmdOutputStart, "Star Auto Scan")
        '
        'lstWritting
        '
        Me.lstWritting.BackColor = System.Drawing.SystemColors.Window
        Me.lstWritting.Cursor = System.Windows.Forms.Cursors.Default
        Me.lstWritting.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lstWritting.ForeColor = System.Drawing.SystemColors.WindowText
        Me.lstWritting.ItemHeight = 14
        Me.lstWritting.Location = New System.Drawing.Point(101, 42)
        Me.lstWritting.Name = "lstWritting"
        Me.lstWritting.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.lstWritting.Size = New System.Drawing.Size(140, 144)
        Me.lstWritting.TabIndex = 21
        '
        'chkEventEnabled
        '
        Me.chkEventEnabled.BackColor = System.Drawing.SystemColors.Control
        Me.chkEventEnabled.Checked = True
        Me.chkEventEnabled.CheckState = System.Windows.Forms.CheckState.Checked
        Me.chkEventEnabled.Cursor = System.Windows.Forms.Cursors.Default
        Me.chkEventEnabled.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.chkEventEnabled.ForeColor = System.Drawing.SystemColors.ControlText
        Me.chkEventEnabled.Location = New System.Drawing.Point(7, 96)
        Me.chkEventEnabled.Name = "chkEventEnabled"
        Me.chkEventEnabled.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.chkEventEnabled.Size = New System.Drawing.Size(97, 21)
        Me.chkEventEnabled.TabIndex = 20
        Me.chkEventEnabled.Text = "Event Enabled"
        '
        'Label10
        '
        Me.Label10.BackColor = System.Drawing.SystemColors.Control
        Me.Label10.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label10.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label10.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label10.Location = New System.Drawing.Point(101, 21)
        Me.Label10.Name = "Label10"
        Me.Label10.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label10.Size = New System.Drawing.Size(80, 18)
        Me.Label10.TabIndex = 24
        Me.Label10.Text = "Writting :"
        '
        'cmdExit
        '
        Me.cmdExit.BackColor = System.Drawing.SystemColors.Control
        Me.cmdExit.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmdExit.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.cmdExit.ForeColor = System.Drawing.SystemColors.ControlText
        Me.cmdExit.Location = New System.Drawing.Point(436, 65)
        Me.cmdExit.Name = "cmdExit"
        Me.cmdExit.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.cmdExit.Size = New System.Drawing.Size(89, 25)
        Me.cmdExit.TabIndex = 20
        Me.cmdExit.Text = "&Close"
        Me.ToolTip1.SetToolTip(Me.cmdExit, "Close application")
        '
        'txtDeviceNum
        '
        Me.txtDeviceNum.AcceptsReturn = True
        Me.txtDeviceNum.AutoSize = False
        Me.txtDeviceNum.BackColor = System.Drawing.SystemColors.Window
        Me.txtDeviceNum.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.txtDeviceNum.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtDeviceNum.ForeColor = System.Drawing.SystemColors.WindowText
        Me.txtDeviceNum.Location = New System.Drawing.Point(88, 24)
        Me.txtDeviceNum.MaxLength = 0
        Me.txtDeviceNum.Name = "txtDeviceNum"
        Me.txtDeviceNum.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.txtDeviceNum.Size = New System.Drawing.Size(57, 19)
        Me.txtDeviceNum.TabIndex = 4
        Me.txtDeviceNum.Text = "-100"
        Me.ToolTip1.SetToolTip(Me.txtDeviceNum, "Device Number")
        '
        'txtDeviceName
        '
        Me.txtDeviceName.AcceptsReturn = True
        Me.txtDeviceName.AutoSize = False
        Me.txtDeviceName.BackColor = System.Drawing.SystemColors.Window
        Me.txtDeviceName.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.txtDeviceName.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtDeviceName.ForeColor = System.Drawing.SystemColors.WindowText
        Me.txtDeviceName.Location = New System.Drawing.Point(88, 48)
        Me.txtDeviceName.MaxLength = 0
        Me.txtDeviceName.Name = "txtDeviceName"
        Me.txtDeviceName.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.txtDeviceName.Size = New System.Drawing.Size(305, 19)
        Me.txtDeviceName.TabIndex = 3
        Me.txtDeviceName.Text = "AdvanTech"
        Me.ToolTip1.SetToolTip(Me.txtDeviceName, "Device Name")
        '
        'cmdSelectDevice
        '
        Me.cmdSelectDevice.BackColor = System.Drawing.SystemColors.Control
        Me.cmdSelectDevice.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmdSelectDevice.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.cmdSelectDevice.ForeColor = System.Drawing.SystemColors.ControlText
        Me.cmdSelectDevice.Location = New System.Drawing.Point(296, 16)
        Me.cmdSelectDevice.Name = "cmdSelectDevice"
        Me.cmdSelectDevice.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.cmdSelectDevice.Size = New System.Drawing.Size(97, 25)
        Me.cmdSelectDevice.TabIndex = 2
        Me.cmdSelectDevice.Text = "&Select Device"
        Me.ToolTip1.SetToolTip(Me.cmdSelectDevice, "Selecting device to operation")
        '
        'Frame1
        '
        Me.Frame1.BackColor = System.Drawing.SystemColors.Control
        Me.Frame1.Controls.Add(Me.txtDeviceNum)
        Me.Frame1.Controls.Add(Me.txtDeviceName)
        Me.Frame1.Controls.Add(Me.cmdSelectDevice)
        Me.Frame1.Controls.Add(Me.Label1)
        Me.Frame1.Controls.Add(Me.Label2)
        Me.Frame1.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Frame1.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Frame1.Location = New System.Drawing.Point(12, 9)
        Me.Frame1.Name = "Frame1"
        Me.Frame1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame1.Size = New System.Drawing.Size(417, 79)
        Me.Frame1.TabIndex = 21
        Me.Frame1.TabStop = False
        Me.Frame1.Text = "Select Device :"
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.BackColor = System.Drawing.SystemColors.Control
        Me.Label1.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label1.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label1.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label1.Location = New System.Drawing.Point(8, 27)
        Me.Label1.Name = "Label1"
        Me.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label1.Size = New System.Drawing.Size(64, 16)
        Me.Label1.TabIndex = 6
        Me.Label1.Text = "Device No. :"
        '
        'Label2
        '
        Me.Label2.AutoSize = True
        Me.Label2.BackColor = System.Drawing.SystemColors.Control
        Me.Label2.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label2.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label2.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label2.Location = New System.Drawing.Point(8, 51)
        Me.Label2.Name = "Label2"
        Me.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label2.Size = New System.Drawing.Size(76, 16)
        Me.Label2.TabIndex = 5
        Me.Label2.Text = "Device Name :"
        '
        'ErrorTimer
        '
        Me.ErrorTimer.Enabled = True
        '
        'DAQAO1
        '
        Me.DAQAO1.Enabled = True
        Me.DAQAO1.Location = New System.Drawing.Point(464, 24)
        Me.DAQAO1.Name = "DAQAO1"
        Me.DAQAO1.OcxState = CType(resources.GetObject("DAQAO1.OcxState"), System.Windows.Forms.AxHost.State)
        Me.DAQAO1.Size = New System.Drawing.Size(33, 33)
        Me.DAQAO1.TabIndex = 24
        '
        'frmAO
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(536, 389)
        Me.Controls.Add(Me.DAQAO1)
        Me.Controls.Add(Me.cmdExit)
        Me.Controls.Add(Me.Frame1)
        Me.Controls.Add(Me.PropertyFrame)
        Me.Controls.Add(Me.Frame4)
        Me.MaximizeBox = False
        Me.Name = "frmAO"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "Anolog output "
        Me.PropertyFrame.ResumeLayout(False)
        Me.Frame4.ResumeLayout(False)
        Me.Frame3.ResumeLayout(False)
        Me.Frame1.ResumeLayout(False)
        CType(Me.DAQAO1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region
    Private Sub chkCyclicMode_CheckStateChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles chkCyclicMode.CheckStateChanged
        If IsInitializing Then
            Exit Sub
        End If
        If chkCyclicMode.CheckState = System.Windows.Forms.CheckState.Checked Then
            DAQAO1.CyclicMode = True
        Else
            DAQAO1.CyclicMode = False
        End If

    End Sub


    Private Sub chkEventEnabled_CheckStateChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles chkEventEnabled.CheckStateChanged
        If IsInitializing Then
            Exit Sub
        End If
        If chkEventEnabled.CheckState = System.Windows.Forms.CheckState.Checked Then
            DAQAO1.EventEnabled = True
        Else
            DAQAO1.EventEnabled = False
        End If
    End Sub

    Private Sub cmbChannel_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmbChannel.SelectedIndexChanged
        If IsInitializing Then
            Exit Sub
        End If
        DAQAO1.Channel = cmbChannel.SelectedIndex
    End Sub


    Private Sub cmbDataType_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmbDataType.SelectedIndexChanged
        If IsInitializing Then
            Exit Sub
        End If
        DAQAO1.DataType = cmbDataType.SelectedIndex
    End Sub

    Private Sub cmdStatus_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdStatus.Click
        txtStatus.Text = CStr(DAQAO1.OutputStatus)
    End Sub

    Private Sub ErrorTimer_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles ErrorTimer.Tick
        txtErrorCode.Text = CStr(DAQAO1.ErrorCode)
        txtErrorMessage.Text = DAQAO1.ErrorMessage

    End Sub

    Private Sub txtNumberOfOutputs_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles txtNumberOfOutputs.Click
        DAQAO1.NumberOfOutputs = Val(txtNumberOfOutputs.Text)
    End Sub

    Private Sub cmbOutputRange_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmbOutputRange.SelectedIndexChanged
        If IsInitializing Then
            Exit Sub
        End If
        OutputRange = (cmbOutputRange.SelectedIndex + 1) * 5 ' 5 ,10 V
    End Sub

    'UPGRADE_WARNING: Event cmbTransferMode.SelectedIndexChanged may fire when form is initialized. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup2075"'
    Private Sub cmbTransferMode_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmbTransferMode.SelectedIndexChanged
        DAQAO1.TransferMode = cmbTransferMode.SelectedIndex
    End Sub

    Private Sub cmdExit_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdExit.Click
        Me.Close()
        End
    End Sub

⌨️ 快捷键说明

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