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

📄 doform.vb

📁 使用研华DAQ和VB.net实现研华数据采集卡的多种功能.包括数据输入输出。内含多个源码
💻 VB
📖 第 1 页 / 共 4 页
字号:
        Me._labBit_7.Size = New System.Drawing.Size(15, 17)
        Me._labBit_7.TabIndex = 31
        Me._labBit_7.Text = "7"
        Me._labBit_7.TextAlign = System.Drawing.ContentAlignment.TopRight
        '
        '_labBit_6
        '
        Me._labBit_6.BackColor = System.Drawing.SystemColors.ActiveBorder
        Me._labBit_6.Cursor = System.Windows.Forms.Cursors.Default
        Me._labBit_6.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me._labBit_6.ForeColor = System.Drawing.SystemColors.WindowText
        Me._labBit_6.Location = New System.Drawing.Point(97, 80)
        Me._labBit_6.Name = "_labBit_6"
        Me._labBit_6.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._labBit_6.Size = New System.Drawing.Size(15, 17)
        Me._labBit_6.TabIndex = 30
        Me._labBit_6.Text = "6"
        Me._labBit_6.TextAlign = System.Drawing.ContentAlignment.TopRight
        '
        '_labBit_5
        '
        Me._labBit_5.BackColor = System.Drawing.SystemColors.ActiveBorder
        Me._labBit_5.Cursor = System.Windows.Forms.Cursors.Default
        Me._labBit_5.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me._labBit_5.ForeColor = System.Drawing.SystemColors.WindowText
        Me._labBit_5.Location = New System.Drawing.Point(129, 80)
        Me._labBit_5.Name = "_labBit_5"
        Me._labBit_5.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._labBit_5.Size = New System.Drawing.Size(15, 17)
        Me._labBit_5.TabIndex = 29
        Me._labBit_5.Text = "5"
        Me._labBit_5.TextAlign = System.Drawing.ContentAlignment.TopRight
        '
        '_labBit_4
        '
        Me._labBit_4.BackColor = System.Drawing.SystemColors.ActiveBorder
        Me._labBit_4.Cursor = System.Windows.Forms.Cursors.Default
        Me._labBit_4.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me._labBit_4.ForeColor = System.Drawing.SystemColors.WindowText
        Me._labBit_4.Location = New System.Drawing.Point(161, 80)
        Me._labBit_4.Name = "_labBit_4"
        Me._labBit_4.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._labBit_4.Size = New System.Drawing.Size(15, 17)
        Me._labBit_4.TabIndex = 28
        Me._labBit_4.Text = "4"
        Me._labBit_4.TextAlign = System.Drawing.ContentAlignment.TopRight
        '
        '_labBit_3
        '
        Me._labBit_3.BackColor = System.Drawing.SystemColors.ActiveBorder
        Me._labBit_3.Cursor = System.Windows.Forms.Cursors.Default
        Me._labBit_3.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me._labBit_3.ForeColor = System.Drawing.SystemColors.WindowText
        Me._labBit_3.Location = New System.Drawing.Point(193, 80)
        Me._labBit_3.Name = "_labBit_3"
        Me._labBit_3.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._labBit_3.Size = New System.Drawing.Size(15, 17)
        Me._labBit_3.TabIndex = 27
        Me._labBit_3.Text = "3"
        Me._labBit_3.TextAlign = System.Drawing.ContentAlignment.TopRight
        '
        '_labBit_2
        '
        Me._labBit_2.BackColor = System.Drawing.SystemColors.ActiveBorder
        Me._labBit_2.Cursor = System.Windows.Forms.Cursors.Default
        Me._labBit_2.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me._labBit_2.ForeColor = System.Drawing.SystemColors.WindowText
        Me._labBit_2.Location = New System.Drawing.Point(225, 80)
        Me._labBit_2.Name = "_labBit_2"
        Me._labBit_2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._labBit_2.Size = New System.Drawing.Size(15, 17)
        Me._labBit_2.TabIndex = 26
        Me._labBit_2.Text = "2"
        Me._labBit_2.TextAlign = System.Drawing.ContentAlignment.TopRight
        '
        '_labBit_1
        '
        Me._labBit_1.BackColor = System.Drawing.SystemColors.ActiveBorder
        Me._labBit_1.Cursor = System.Windows.Forms.Cursors.Default
        Me._labBit_1.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me._labBit_1.ForeColor = System.Drawing.SystemColors.WindowText
        Me._labBit_1.Location = New System.Drawing.Point(257, 80)
        Me._labBit_1.Name = "_labBit_1"
        Me._labBit_1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._labBit_1.Size = New System.Drawing.Size(15, 17)
        Me._labBit_1.TabIndex = 25
        Me._labBit_1.Text = "1"
        Me._labBit_1.TextAlign = System.Drawing.ContentAlignment.TopRight
        '
        '_labBit_0
        '
        Me._labBit_0.BackColor = System.Drawing.SystemColors.ActiveBorder
        Me._labBit_0.Cursor = System.Windows.Forms.Cursors.Default
        Me._labBit_0.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me._labBit_0.ForeColor = System.Drawing.SystemColors.WindowText
        Me._labBit_0.Location = New System.Drawing.Point(289, 80)
        Me._labBit_0.Name = "_labBit_0"
        Me._labBit_0.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._labBit_0.Size = New System.Drawing.Size(15, 17)
        Me._labBit_0.TabIndex = 24
        Me._labBit_0.Text = "0"
        Me._labBit_0.TextAlign = System.Drawing.ContentAlignment.TopRight
        '
        'cmbPort
        '
        Me.cmbPort.BackColor = System.Drawing.SystemColors.Window
        Me.cmbPort.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmbPort.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbPort.Enabled = False
        Me.cmbPort.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.cmbPort.ForeColor = System.Drawing.SystemColors.WindowText
        Me.cmbPort.ItemHeight = 14
        Me.cmbPort.Items.AddRange(New Object() {"0", "1", "2", "3"})
        Me.cmbPort.Location = New System.Drawing.Point(408, 112)
        Me.cmbPort.Name = "cmbPort"
        Me.cmbPort.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.cmbPort.Size = New System.Drawing.Size(104, 22)
        Me.cmbPort.TabIndex = 50
        '
        'Label6
        '
        Me.Label6.Location = New System.Drawing.Point(368, 112)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(40, 16)
        Me.Label6.TabIndex = 51
        Me.Label6.Text = "Port"
        '
        'txtMask
        '
        Me.txtMask.AcceptsReturn = True
        Me.txtMask.AutoSize = False
        Me.txtMask.BackColor = System.Drawing.SystemColors.Window
        Me.txtMask.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.txtMask.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtMask.ForeColor = System.Drawing.SystemColors.WindowText
        Me.txtMask.Location = New System.Drawing.Point(408, 139)
        Me.txtMask.MaxLength = 0
        Me.txtMask.Name = "txtMask"
        Me.txtMask.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.txtMask.Size = New System.Drawing.Size(104, 24)
        Me.txtMask.TabIndex = 52
        Me.txtMask.Text = "00"
        '
        'Label7
        '
        Me.Label7.Location = New System.Drawing.Point(368, 140)
        Me.Label7.Name = "Label7"
        Me.Label7.Size = New System.Drawing.Size(40, 16)
        Me.Label7.TabIndex = 53
        Me.Label7.Text = "Mask"
        '
        'txtOutByte
        '
        Me.txtOutByte.AcceptsReturn = True
        Me.txtOutByte.AutoSize = False
        Me.txtOutByte.BackColor = System.Drawing.SystemColors.Window
        Me.txtOutByte.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.txtOutByte.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtOutByte.ForeColor = System.Drawing.SystemColors.WindowText
        Me.txtOutByte.Location = New System.Drawing.Point(360, 168)
        Me.txtOutByte.MaxLength = 0
        Me.txtOutByte.Name = "txtOutByte"
        Me.txtOutByte.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.txtOutByte.Size = New System.Drawing.Size(64, 24)
        Me.txtOutByte.TabIndex = 54
        Me.txtOutByte.Text = "00"
        '
        'txtReadBack
        '
        Me.txtReadBack.AcceptsReturn = True
        Me.txtReadBack.AutoSize = False
        Me.txtReadBack.BackColor = System.Drawing.SystemColors.Window
        Me.txtReadBack.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.txtReadBack.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtReadBack.ForeColor = System.Drawing.SystemColors.WindowText
        Me.txtReadBack.Location = New System.Drawing.Point(360, 200)
        Me.txtReadBack.MaxLength = 0
        Me.txtReadBack.Name = "txtReadBack"
        Me.txtReadBack.ReadOnly = True
        Me.txtReadBack.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.txtReadBack.Size = New System.Drawing.Size(64, 24)
        Me.txtReadBack.TabIndex = 55
        Me.txtReadBack.Text = "00"
        '
        'frmDO
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(528, 237)
        Me.Controls.Add(Me.txtReadBack)
        Me.Controls.Add(Me.txtOutByte)
        Me.Controls.Add(Me.Label7)
        Me.Controls.Add(Me.txtMask)
        Me.Controls.Add(Me.Label6)
        Me.Controls.Add(Me.cmdByteOut)
        Me.Controls.Add(Me.cmdReadBack)
        Me.Controls.Add(Me.framChannel)
        Me.Controls.Add(Me.cmbPort)
        Me.Controls.Add(Me.Frame1)
        Me.Controls.Add(Me.cmdExit)
        Me.Controls.Add(Me.DAQDO1)
        Me.MaximizeBox = False
        Me.Name = "frmDO"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "Digital Output"
        CType(Me.DAQDO1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.Frame1.ResumeLayout(False)
        Me.framChannel.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        '  Button1.BackColor = Color.Red
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        cmdSelectDevice_Click(sender, e)
    End Sub



    Private Sub cmdSelectDevice_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSelectDevice.Click
        Dim i As Object
        Dim Ret As Integer

        If bOpen Then
            DAQDO1.CloseDevice()
            bOpen = False
            cmbPort.Enabled = False
        End If

        ' Select Device from installed list
        Ret = DAQDO1.SelectDevice
        txtDeviceNum.Text = CStr(DAQDO1.DeviceNumber)
        txtDeviceName.Text = DAQDO1.DeviceName

        ' Open Device
        If DAQDO1.OpenDevice Then
            MsgBox(DAQDO1.ErrorMessage, MsgBoxStyle.OKOnly)
            Exit Sub
        End If

        If DAQDO1.MaxPortNumber = 0 Then
            MsgBox("Function Not Supported", MsgBoxStyle.OKOnly)
            DAQDO1.CloseDevice()
            Exit Sub
        End If
        cmbPort.Enabled = True
        bOpen = True
        ' Add Port number to list box
        cmbPort.Items.Clear()
        For i = 0 To DAQDO1.MaxPortNumber - 1
            cmbPort.Items.Add((Str(i)))
        Next i
        If DAQDO1.MaxPortNumber Then
            cmbPort.SelectedIndex = DAQDO1.Port
        End If
        UpdateStatus()
        UpdateMask()
    End Sub

    Private Sub txtDeviceNum_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtDeviceNum.TextChanged
        'may fire when form is initialized
        If (isInitializing) Then
            Exit Sub
        End If

        Dim i As Integer
        DAQDO1.DeviceNumber = Val(txtDeviceNum.Text)
        txtDeviceName.Text = DAQDO1.DeviceName
        ' Open Device
        If DAQDO1.OpenDevice Then
            MsgBox(DAQDO1.ErrorMessage, MsgBoxStyle.OKOnly)

⌨️ 快捷键说明

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