'========================================================================== ====
' File: ULAI06.VB
' Library Call Demonstrated: Mccdaq.MccBoard.AInScan(), continuous background mode
' Purpose: Scans a range of A/D Input Channels continuously
' in the background and stores the data in an array.
' Demonstration: Continuously collects data on eight channels.
' Other Library Calls: Mccdaq.MccBoard.GetStatus() ' Mccdaq.MccBoard.StopBackground() ' Mccdaq.MccBoard.ErrHandling()
' Special Requirements: Board 1 must have an A/D converter. ' Analog signals on up to eight input channels.
'========================================================================== ====
Option Strict Off Option Explicit On
Imports Microsoft.Office.Interop Friend Class frmStatusDisplay
Inherits System.Windows.Forms.Form
Const NumPoints As Integer = 64 ' Number of data points to collect 'Create a new MccBoard object for Board 1
Private DaqBoard As MccDaq.MccBoard = New MccDaq.MccBoard(1)
Dim ADData(NumPoints) As UInt16 ' dimension an array to hold the input values
Dim MemHandle As Integer
Dim ChanTags(NumPoints) As UInt16
' define a variable to contain the handle for
' memory allocated by Windows through MccDaq.MccService.WinBufAlloc() Dim HighChan As Integer
Public lblADData As System.Windows.Forms.Label() Public lblVolt As System.Windows.Forms.Label()
Private Sub cmdStartBgnd_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdStartBgnd.Click
Dim CurIndex As Integer Dim CurCount As Integer Dim Status As Short
Dim ULStat As MccDaq.ErrorInfo Dim Range As MccDaq.Range
Dim Options As MccDaq.ScanOptions Dim Rate As Integer
Dim Count As Integer Dim LowChan As Short
cmdStartBgnd.Enabled = False cmdStartBgnd.Visible = False cmdStopConvert.Enabled = True cmdStopConvert.Visible = True cmdQuit.Enabled = False
' Collect the values by calling MccDaq.MccBoard.AInScan ' Parameters:
' LowChan :the first channel of the scan ' HighChan :the last channel of the scan
' Count :the total number of A/D samples to collect ' Rate :sample rate
' Range :the range for the board
' MemHandle :Handle for Windows buffer to store data in ' Options :data collection options
LowChan = 0 ' first channel to acquire HighChan = 5
If HighChan > 5 Then HighChan = 5
Count = NumPoints ' total number of data points to collect Rate = 200 ' per channel sampling rate ((samples per second) per channel)
Options = MccDaq.ScanOptions.Background Or MccDaq.ScanOptions.Continuous
' collect data in background continuously
Range = MccDaq.Range.Bip10Volts ' set the range
If MemHandle = 0 Then Stop ' check that a handle to a memory buffer exists
ULStat = DaqBoard.AInScan(LowChan, HighChan, Count, Rate, Range, MemHandle, Options)
If ULStat.Value <> MccDaq.ErrorInfo.ErrorCode.NoErrors Then Stop ULStat = DaqBoard.GetStatus(Status, CurCount, CurIndex,
MccDaq.FunctionType.AiFunction)
If ULStat.Value <> MccDaq.ErrorInfo.ErrorCode.NoErrors Then Stop tmrCheckStatus.Enabled = True
End Sub
Private Sub tmrCheckStatus_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles tmrCheckStatus.Tick
Dim i As Integer
Dim FirstPoint As Integer Dim ULStat As MccDaq.ErrorInfo Dim CurIndex As Integer
Dim CurCount As Integer Dim Status As Short tmrCheckStatus.Stop()
' Check the status of the background data collection ' Parameters:
' Status :current status of the background data collection ' CurCount :current number of samples collected
' CurIndex :index to the data buffer pointing to the start of the
' most recently collected scan
' FunctionType: A/D operation (MccDaq.FunctionType.AiFunction) ULStat = DaqBoard.GetStatus(Status, CurCount, CurIndex,
MccDaq.FunctionType.AiFunction)
If ULStat.Value <> MccDaq.ErrorInfo.ErrorCode.NoErrors Then Stop ' Check the background operation.
' transfer the data from the memory buffer set up by Windows to an ' array for use by Visual Basic
' The background operation must be explicitly stopped ULStat = DaqBoard.GetStatus(Status, CurCount, CurIndex, MccDaq.FunctionType.AiFunction)
If ULStat.Value <> MccDaq.ErrorInfo.ErrorCode.NoErrors Then Stop tmrCheckStatus.Start()
If CurIndex > HighChan Then If MemHandle = 0 Then Stop
FirstPoint = CurIndex 'start of latest channel scan in MemHandle buffer
ULStat = MccDaq.MccService.WinBufToArray(MemHandle, ADData(0), FirstPoint, 8)
If ULStat.Value <> MccDaq.ErrorInfo.ErrorCode.NoErrors Then Stop
' Use MccDaq.MccBoard.AConvertData() to convert the 16-bit values
' in ADData() to 12-bit values ' Parameters:
' NumPoints :the number of data values to convert
' ADData :the array holding the 16-bit data values to be converted
' ChanTags :the array in which the channel information will be stored
ULStat = DaqBoard.AConvertData(NumPoints, ADData(0), ChanTags(0))
If ULStat.Value <> MccDaq.ErrorInfo.ErrorCode.NoErrors Then Stop For i = 0 To HighChan tmrCheckStatus.Stop() lblADData(i).Text = ADData(i).ToString("D") lblVolt(i).Text = (Integer.Parse(ADData(i).ToString) / 204.8 - 10).ToString tmrCheckStatus.Start() Next i End If End Sub
Private Sub cmdStopConvert_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdStopConvert.Click
Dim CurIndex As Integer Dim CurCount As Integer Dim Status As Short
Dim ULStat As MccDaq.ErrorInfo
If ULStat.Value <> MccDaq.ErrorInfo.ErrorCode.NoErrors Then Stop cmdStartBgnd.Enabled = True : cmdStartBgnd.Visible = True
cmdStopConvert.Enabled = False : cmdStopConvert.Visible = False cmdQuit.Enabled = True
tmrCheckStatus.Enabled = False
ULStat = DaqBoard.GetStatus(Status, CurCount, CurIndex, MccDaq.FunctionType.AiFunction)
If ULStat.Value <> MccDaq.ErrorInfo.ErrorCode.NoErrors Then Stop End Sub
Private Sub cmdQuit_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdQuit.Click
Dim ULStat As MccDaq.ErrorInfo
ULStat = MccDaq.MccService.WinBufFree(MemHandle) ' Free up memory for use by other programs
If ULStat.Value <> MccDaq.ErrorInfo.ErrorCode.NoErrors Then Stop End
End Sub
#Region "Windows Form Designer generated code " Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer. InitializeComponent()
InitUL() End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean) If Disposing Then
If Not components Is Nothing Then components.Dispose()
End If End If
MyBase.Dispose(Disposing) End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer Public ToolTip1 As System.Windows.Forms.ToolTip
Public WithEvents cmdQuit As System.Windows.Forms.Button
Public WithEvents tmrCheckStatus As System.Windows.Forms.Timer Public WithEvents cmdStartBgnd As System.Windows.Forms.Button Public WithEvents cmdStopConvert As System.Windows.Forms.Button Public WithEvents _lblADData_3 As System.Windows.Forms.Label Public WithEvents lblChan3 As System.Windows.Forms.Label Public WithEvents _lblADData_2 As System.Windows.Forms.Label Public WithEvents lblChan2 As System.Windows.Forms.Label Public WithEvents _lblADData_1 As System.Windows.Forms.Label Public WithEvents lblChan1 As System.Windows.Forms.Label Public WithEvents _lblADData_4 As System.Windows.Forms.Label Public WithEvents lblChan4 As System.Windows.Forms.Label Public WithEvents _lblADData_0 As System.Windows.Forms.Label Public WithEvents lblChan0 As System.Windows.Forms.Label Public WithEvents _lblVolt_3 As System.Windows.Forms.Label Public WithEvents _lblVolt_2 As System.Windows.Forms.Label Public WithEvents _lblVolt_1 As System.Windows.Forms.Label
Public WithEvents _lblVolt_4 As System.Windows.Forms.Label Public WithEvents _lblVolt_0 As System.Windows.Forms.Label Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents Label2 As System.Windows.Forms.Label Public WithEvents Label3 As System.Windows.Forms.Label Public WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox Friend WithEvents ComboBox2 As System.Windows.Forms.ComboBox
'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Public WithEvents Herbegin As System.Windows.Forms.Button Public WithEvents Volgende As System.Windows.Forms.Button Public WithEvents Vorige As System.Windows.Forms.Button Public WithEvents Inlezen As System.Windows.Forms.Button Friend WithEvents OpenFileDialog1 As
System.Windows.Forms.OpenFileDialog
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem Friend WithEvents MenuItem3 As System.Windows.Forms.MenuItem Friend WithEvents MenuItem4 As System.Windows.Forms.MenuItem Friend WithEvents MenuItem6 As System.Windows.Forms.MenuItem Public WithEvents _lblADData_5 As System.Windows.Forms.Label Public WithEvents Label5 As System.Windows.Forms.Label
Public WithEvents _lblVolt_5 As System.Windows.Forms.Label <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components) Me.cmdQuit = New System.Windows.Forms.Button
Me.tmrCheckStatus = New System.Windows.Forms.Timer(Me.components) Me.cmdStartBgnd = New System.Windows.Forms.Button
Me.cmdStopConvert = New System.Windows.Forms.Button Me._lblADData_3 = New System.Windows.Forms.Label Me.lblChan3 = New System.Windows.Forms.Label Me._lblADData_2 = New System.Windows.Forms.Label Me.lblChan2 = New System.Windows.Forms.Label Me._lblADData_1 = New System.Windows.Forms.Label Me.lblChan1 = New System.Windows.Forms.Label Me._lblADData_4 = New System.Windows.Forms.Label Me.lblChan4 = New System.Windows.Forms.Label Me._lblADData_0 = New System.Windows.Forms.Label Me.lblChan0 = New System.Windows.Forms.Label Me._lblVolt_3 = New System.Windows.Forms.Label Me._lblVolt_2 = New System.Windows.Forms.Label Me._lblVolt_1 = New System.Windows.Forms.Label Me._lblVolt_4 = New System.Windows.Forms.Label Me._lblVolt_0 = New System.Windows.Forms.Label Me.Label1 = New System.Windows.Forms.Label Me.Label2 = New System.Windows.Forms.Label Me.Herbegin = New System.Windows.Forms.Button Me.Label3 = New System.Windows.Forms.Label Me.Label4 = New System.Windows.Forms.Label
Me.ComboBox1 = New System.Windows.Forms.ComboBox Me.ComboBox2 = New System.Windows.Forms.ComboBox Me.Volgende = New System.Windows.Forms.Button Me.Vorige = New System.Windows.Forms.Button
Me.Inlezen = New System.Windows.Forms.Button
Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog Me.TextBox1 = New System.Windows.Forms.TextBox
Me.MainMenu1 = New System.Windows.Forms.MainMenu Me.MenuItem1 = New System.Windows.Forms.MenuItem Me.MenuItem3 = New System.Windows.Forms.MenuItem Me.MenuItem4 = New System.Windows.Forms.MenuItem Me.MenuItem6 = New System.Windows.Forms.MenuItem Me.MenuItem2 = New System.Windows.Forms.MenuItem Me._lblADData_5 = New System.Windows.Forms.Label Me.Label5 = New System.Windows.Forms.Label
Me._lblVolt_5 = New System.Windows.Forms.Label Me.SuspendLayout() ' 'cmdQuit ' Me.cmdQuit.BackColor = System.Drawing.SystemColors.Control Me.cmdQuit.Cursor = System.Windows.Forms.Cursors.Default Me.cmdQuit.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.cmdQuit.ForeColor = System.Drawing.SystemColors.ControlText Me.cmdQuit.Location = New System.Drawing.Point(16, 152)
Me.cmdQuit.Name = "cmdQuit"
Me.cmdQuit.RightToLeft = System.Windows.Forms.RightToLeft.No Me.cmdQuit.Size = New System.Drawing.Size(72, 26)
Me.cmdQuit.TabIndex = 19 Me.cmdQuit.Text = "Afsluiten" ' 'tmrCheckStatus ' Me.tmrCheckStatus.Interval = 200 ' 'cmdStartBgnd ' Me.cmdStartBgnd.BackColor = System.Drawing.SystemColors.Control Me.cmdStartBgnd.Cursor = System.Windows.Forms.Cursors.Default Me.cmdStartBgnd.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.cmdStartBgnd.ForeColor = System.Drawing.SystemColors.ControlText Me.cmdStartBgnd.Location = New System.Drawing.Point(16, 88)
Me.cmdStartBgnd.Name = "cmdStartBgnd"
Me.cmdStartBgnd.RightToLeft = System.Windows.Forms.RightToLeft.No Me.cmdStartBgnd.Size = New System.Drawing.Size(72, 27)
Me.cmdStartBgnd.TabIndex = 18 Me.cmdStartBgnd.Text = "Start" ' 'cmdStopConvert ' Me.cmdStopConvert.BackColor = System.Drawing.SystemColors.Control Me.cmdStopConvert.Cursor = System.Windows.Forms.Cursors.Default Me.cmdStopConvert.Enabled = False
Me.cmdStopConvert.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.cmdStopConvert.ForeColor = System.Drawing.SystemColors.ControlText
Me.cmdStopConvert.Location = New System.Drawing.Point(16, 88) Me.cmdStopConvert.Name = "cmdStopConvert"
Me.cmdStopConvert.Size = New System.Drawing.Size(69, 27) Me.cmdStopConvert.TabIndex = 17 Me.cmdStopConvert.Text = "Stop" Me.cmdStopConvert.Visible = False ' '_lblADData_3 ' Me._lblADData_3.BackColor = System.Drawing.SystemColors.Window Me._lblADData_3.Cursor = System.Windows.Forms.Cursors.Default Me._lblADData_3.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me._lblADData_3.ForeColor = System.Drawing.Color.Blue
Me._lblADData_3.Location = New System.Drawing.Point(280, 168) Me._lblADData_3.Name = "_lblADData_3"
Me._lblADData_3.RightToLeft = System.Windows.Forms.RightToLeft.No Me._lblADData_3.Size = New System.Drawing.Size(65, 17)
Me._lblADData_3.TabIndex = 12 Me._lblADData_3.Visible = False ' 'lblChan3 ' Me.lblChan3.BackColor = System.Drawing.SystemColors.Window Me.lblChan3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.lblChan3.Cursor = System.Windows.Forms.Cursors.Default Me.lblChan3.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblChan3.ForeColor = System.Drawing.SystemColors.WindowText Me.lblChan3.Location = New System.Drawing.Point(240, 168) Me.lblChan3.Name = "lblChan3"
Me.lblChan3.RightToLeft = System.Windows.Forms.RightToLeft.No Me.lblChan3.Size = New System.Drawing.Size(32, 16)
Me.lblChan3.TabIndex = 4 Me.lblChan3.Text = "Ta" Me.lblChan3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter ' '_lblADData_2 ' Me._lblADData_2.BackColor = System.Drawing.SystemColors.Window Me._lblADData_2.Cursor = System.Windows.Forms.Cursors.Default Me._lblADData_2.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me._lblADData_2.ForeColor = System.Drawing.Color.Blue
Me._lblADData_2.Location = New System.Drawing.Point(280, 144) Me._lblADData_2.Name = "_lblADData_2"
Me._lblADData_2.RightToLeft = System.Windows.Forms.RightToLeft.No Me._lblADData_2.Size = New System.Drawing.Size(65, 17)
Me._lblADData_2.TabIndex = 11 Me._lblADData_2.Visible = False ' 'lblChan2 ' Me.lblChan2.BackColor = System.Drawing.SystemColors.Window Me.lblChan2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.lblChan2.Cursor = System.Windows.Forms.Cursors.Default
Me.lblChan2.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblChan2.ForeColor = System.Drawing.SystemColors.WindowText Me.lblChan2.Location = New System.Drawing.Point(240, 144) Me.lblChan2.Name = "lblChan2"
Me.lblChan2.RightToLeft = System.Windows.Forms.RightToLeft.No Me.lblChan2.Size = New System.Drawing.Size(32, 16)
Me.lblChan2.TabIndex = 3 Me.lblChan2.Text = "n" Me.lblChan2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter ' '_lblADData_1 ' Me._lblADData_1.BackColor = System.Drawing.SystemColors.Window Me._lblADData_1.Cursor = System.Windows.Forms.Cursors.Default Me._lblADData_1.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me._lblADData_1.ForeColor = System.Drawing.Color.Blue
Me._lblADData_1.Location = New System.Drawing.Point(280, 120) Me._lblADData_1.Name = "_lblADData_1"
Me._lblADData_1.RightToLeft = System.Windows.Forms.RightToLeft.No Me._lblADData_1.Size = New System.Drawing.Size(65, 17)
Me._lblADData_1.TabIndex = 10 Me._lblADData_1.Visible = False ' 'lblChan1 ' Me.lblChan1.BackColor = System.Drawing.SystemColors.Window Me.lblChan1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.lblChan1.Cursor = System.Windows.Forms.Cursors.Default Me.lblChan1.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblChan1.ForeColor = System.Drawing.SystemColors.WindowText Me.lblChan1.Location = New System.Drawing.Point(240, 120) Me.lblChan1.Name = "lblChan1"
Me.lblChan1.RightToLeft = System.Windows.Forms.RightToLeft.No Me.lblChan1.Size = New System.Drawing.Size(32, 17)
Me.lblChan1.TabIndex = 2 Me.lblChan1.Text = "dps" Me.lblChan1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter ' '_lblADData_4 ' Me._lblADData_4.BackColor = System.Drawing.SystemColors.Window Me._lblADData_4.Cursor = System.Windows.Forms.Cursors.Default Me._lblADData_4.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me._lblADData_4.ForeColor = System.Drawing.Color.Blue
Me._lblADData_4.Location = New System.Drawing.Point(280, 192) Me._lblADData_4.Name = "_lblADData_4"
Me._lblADData_4.RightToLeft = System.Windows.Forms.RightToLeft.No Me._lblADData_4.Size = New System.Drawing.Size(65, 17)
Me._lblADData_4.TabIndex = 13 Me._lblADData_4.Visible = False
' 'lblChan4 ' Me.lblChan4.BackColor = System.Drawing.SystemColors.Window Me.lblChan4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.lblChan4.Cursor = System.Windows.Forms.Cursors.Default Me.lblChan4.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblChan4.ForeColor = System.Drawing.SystemColors.WindowText Me.lblChan4.Location = New System.Drawing.Point(240, 192) Me.lblChan4.Name = "lblChan4"
Me.lblChan4.RightToLeft = System.Windows.Forms.RightToLeft.No Me.lblChan4.Size = New System.Drawing.Size(32, 17)
Me.lblChan4.TabIndex = 5 Me.lblChan4.Text = "Pe" Me.lblChan4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter ' '_lblADData_0 ' Me._lblADData_0.BackColor = System.Drawing.SystemColors.Window Me._lblADData_0.Cursor = System.Windows.Forms.Cursors.Default Me._lblADData_0.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me._lblADData_0.ForeColor = System.Drawing.Color.Blue
Me._lblADData_0.Location = New System.Drawing.Point(280, 96) Me._lblADData_0.Name = "_lblADData_0"
Me._lblADData_0.RightToLeft = System.Windows.Forms.RightToLeft.No Me._lblADData_0.Size = New System.Drawing.Size(65, 17)
Me._lblADData_0.TabIndex = 9 ' 'lblChan0 ' Me.lblChan0.BackColor = System.Drawing.SystemColors.Window Me.lblChan0.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.lblChan0.Cursor = System.Windows.Forms.Cursors.Default Me.lblChan0.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblChan0.ForeColor = System.Drawing.SystemColors.WindowText Me.lblChan0.Location = New System.Drawing.Point(240, 96)
Me.lblChan0.Name = "lblChan0"
Me.lblChan0.RightToLeft = System.Windows.Forms.RightToLeft.No Me.lblChan0.Size = New System.Drawing.Size(32, 17)
Me.lblChan0.TabIndex = 1 Me.lblChan0.Text = "dpo" Me.lblChan0.TextAlign = System.Drawing.ContentAlignment.MiddleCenter ' '_lblVolt_3 ' Me._lblVolt_3.BackColor = System.Drawing.SystemColors.Window Me._lblVolt_3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me._lblVolt_3.Cursor = System.Windows.Forms.Cursors.Default
Me._lblVolt_3.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me._lblVolt_3.ForeColor = System.Drawing.Color.Blue
Me._lblVolt_3.Location = New System.Drawing.Point(280, 168) Me._lblVolt_3.Name = "_lblVolt_3"
Me._lblVolt_3.RightToLeft = System.Windows.Forms.RightToLeft.No Me._lblVolt_3.Size = New System.Drawing.Size(56, 17)
Me._lblVolt_3.TabIndex = 33 ' '_lblVolt_2 ' Me._lblVolt_2.BackColor = System.Drawing.SystemColors.Window Me._lblVolt_2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me._lblVolt_2.Cursor = System.Windows.Forms.Cursors.Default Me._lblVolt_2.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me._lblVolt_2.ForeColor = System.Drawing.Color.Blue
Me._lblVolt_2.Location = New System.Drawing.Point(280, 144) Me._lblVolt_2.Name = "_lblVolt_2"
Me._lblVolt_2.RightToLeft = System.Windows.Forms.RightToLeft.No Me._lblVolt_2.Size = New System.Drawing.Size(56, 17)
Me._lblVolt_2.TabIndex = 32 ' '_lblVolt_1 ' Me._lblVolt_1.BackColor = System.Drawing.SystemColors.Window Me._lblVolt_1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me._lblVolt_1.Cursor = System.Windows.Forms.Cursors.Default Me._lblVolt_1.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me._lblVolt_1.ForeColor = System.Drawing.Color.Blue
Me._lblVolt_1.Location = New System.Drawing.Point(280, 120) Me._lblVolt_1.Name = "_lblVolt_1"
Me._lblVolt_1.RightToLeft = System.Windows.Forms.RightToLeft.No Me._lblVolt_1.Size = New System.Drawing.Size(56, 17)
Me._lblVolt_1.TabIndex = 31 ' '_lblVolt_4 ' Me._lblVolt_4.BackColor = System.Drawing.SystemColors.Window Me._lblVolt_4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me._lblVolt_4.Cursor = System.Windows.Forms.Cursors.Default Me._lblVolt_4.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me._lblVolt_4.ForeColor = System.Drawing.Color.Blue
Me._lblVolt_4.Location = New System.Drawing.Point(280, 192) Me._lblVolt_4.Name = "_lblVolt_4"
Me._lblVolt_4.RightToLeft = System.Windows.Forms.RightToLeft.No Me._lblVolt_4.Size = New System.Drawing.Size(56, 17)
Me._lblVolt_4.TabIndex = 34 '
'_lblVolt_0 '
Me._lblVolt_0.BorderStyle =
System.Windows.Forms.BorderStyle.FixedSingle
Me._lblVolt_0.Cursor = System.Windows.Forms.Cursors.Default Me._lblVolt_0.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me._lblVolt_0.ForeColor = System.Drawing.Color.Blue
Me._lblVolt_0.Location = New System.Drawing.Point(280, 96) Me._lblVolt_0.Name = "_lblVolt_0"
Me._lblVolt_0.Size = New System.Drawing.Size(56, 17) Me._lblVolt_0.TabIndex = 30
'
'Label1 '
Me.Label1.Font = New System.Drawing.Font("Arial", 12.0!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.Location = New System.Drawing.Point(8, 8) Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(336, 24) Me.Label1.TabIndex = 35
Me.Label1.Text = "Meten" '
'Label2 '
Me.Label2.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label2.ForeColor = System.Drawing.Color.Black Me.Label2.Location = New System.Drawing.Point(8, 40) Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(336, 40) Me.Label2.TabIndex = 36
Me.Label2.Text = "Via dit dialoogvenster zullen we de stappen doorlopen die nodig zijn de gemeten w" & _
"aarden in te lezen in het tabblad 'Data' in excel." '
'Herbegin '
Me.Herbegin.BackColor = System.Drawing.SystemColors.Control Me.Herbegin.Cursor = System.Windows.Forms.Cursors.Default Me.Herbegin.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Herbegin.ForeColor = System.Drawing.SystemColors.ControlText Me.Herbegin.Location = New System.Drawing.Point(16, 120)
Me.Herbegin.Name = "Herbegin"
Me.Herbegin.RightToLeft = System.Windows.Forms.RightToLeft.No Me.Herbegin.Size = New System.Drawing.Size(72, 27)
Me.Herbegin.TabIndex = 37 Me.Herbegin.Text = "Herbegin" ' 'Label3 ' Me.Label3.BackColor = System.Drawing.SystemColors.Window Me.Label3.Cursor = System.Windows.Forms.Cursors.Default Me.Label3.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label3.ForeColor = System.Drawing.SystemColors.WindowText Me.Label3.Location = New System.Drawing.Point(112, 88)
Me.Label3.Name = "Label3"
Me.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No Me.Label3.Size = New System.Drawing.Size(56, 17)
Me.Label3.TabIndex = 38 Me.Label3.Text = "% Pin" Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter ' 'Label4 ' Me.Label4.BackColor = System.Drawing.SystemColors.Window Me.Label4.Cursor = System.Windows.Forms.Cursors.Default Me.Label4.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label4.ForeColor = System.Drawing.SystemColors.WindowText Me.Label4.Location = New System.Drawing.Point(112, 120) Me.Label4.Name = "Label4"
Me.Label4.RightToLeft = System.Windows.Forms.RightToLeft.No Me.Label4.Size = New System.Drawing.Size(56, 17)
Me.Label4.TabIndex = 39 Me.Label4.Text = "Uitgang %" Me.Label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter ' 'ComboBox1 ' Me.ComboBox1.Items.AddRange(New Object() {"0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100"})
Me.ComboBox1.Location = New System.Drawing.Point(176, 88) Me.ComboBox1.Name = "ComboBox1"
Me.ComboBox1.Size = New System.Drawing.Size(48, 22) Me.ComboBox1.TabIndex = 40 Me.ComboBox1.Text = "0" ' 'ComboBox2 ' Me.ComboBox2.Items.AddRange(New Object() {"0", "25", "50", "75", "100"})
Me.ComboBox2.Location = New System.Drawing.Point(176, 120) Me.ComboBox2.Name = "ComboBox2"
Me.ComboBox2.Size = New System.Drawing.Size(48, 22) Me.ComboBox2.TabIndex = 41 Me.ComboBox2.Text = "0" ' 'Volgende ' Me.Volgende.BackColor = System.Drawing.SystemColors.Control Me.Volgende.Cursor = System.Windows.Forms.Cursors.Default Me.Volgende.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Volgende.ForeColor = System.Drawing.SystemColors.ControlText Me.Volgende.Location = New System.Drawing.Point(168, 152)
Me.Volgende.Name = "Volgende"
Me.Volgende.Size = New System.Drawing.Size(64, 27) Me.Volgende.TabIndex = 42 Me.Volgende.Text = "Volgende" ' 'Vorige ' Me.Vorige.BackColor = System.Drawing.SystemColors.Control Me.Vorige.Cursor = System.Windows.Forms.Cursors.Default
Me.Vorige.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Vorige.ForeColor = System.Drawing.SystemColors.ControlText Me.Vorige.Location = New System.Drawing.Point(104, 152)
Me.Vorige.Name = "Vorige"
Me.Vorige.RightToLeft = System.Windows.Forms.RightToLeft.No Me.Vorige.Size = New System.Drawing.Size(64, 27)
Me.Vorige.TabIndex = 43 Me.Vorige.Text = "Vorige" ' 'Inlezen ' Me.Inlezen.BackColor = System.Drawing.SystemColors.Control Me.Inlezen.Cursor = System.Windows.Forms.Cursors.Default Me.Inlezen.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Inlezen.ForeColor = System.Drawing.SystemColors.ControlText Me.Inlezen.Location = New System.Drawing.Point(136, 184)
Me.Inlezen.Name = "Inlezen"
Me.Inlezen.RightToLeft = System.Windows.Forms.RightToLeft.No Me.Inlezen.Size = New System.Drawing.Size(64, 27)
Me.Inlezen.TabIndex = 44 Me.Inlezen.Text = "Inlezen" '
'TextBox1 '
Me.TextBox1.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TextBox1.Location = New System.Drawing.Point(0, 256) Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(352, 20) Me.TextBox1.TabIndex = 46
Me.TextBox1.Text = "C:\Documents and Settings\Student\Mijn Documenten\Ventilatorproef\Ventilatorproef" & _ ".xls" Me.TextBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right ' 'MainMenu1 ' Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1, Me.MenuItem4, Me.MenuItem2})
' 'MenuItem1 ' Me.MenuItem1.Index = 0 Me.MenuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem3}) Me.MenuItem1.Text = "File" ' 'MenuItem3 ' Me.MenuItem3.Index = 0 Me.MenuItem3.Text = "Exit" ' 'MenuItem4 ' Me.MenuItem4.Index = 1
Me.MenuItem4.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem6}) Me.MenuItem4.Text = "Instellingen" ' 'MenuItem6 ' Me.MenuItem6.Index = 0
Me.MenuItem6.Text = "Inlezen in" ' 'MenuItem2 ' Me.MenuItem2.Index = 2 Me.MenuItem2.Text = "Help" ' '_lblADData_5 ' Me._lblADData_5.BackColor = System.Drawing.SystemColors.Window Me._lblADData_5.Cursor = System.Windows.Forms.Cursors.Default Me._lblADData_5.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me._lblADData_5.ForeColor = System.Drawing.Color.Blue
Me._lblADData_5.Location = New System.Drawing.Point(280, 224) Me._lblADData_5.Name = "_lblADData_5"
Me._lblADData_5.RightToLeft = System.Windows.Forms.RightToLeft.No Me._lblADData_5.Size = New System.Drawing.Size(65, 17)
Me._lblADData_5.TabIndex = 48 Me._lblADData_5.Visible = False ' 'Label5 ' Me.Label5.BackColor = System.Drawing.SystemColors.Window Me.Label5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.Label5.Cursor = System.Windows.Forms.Cursors.Default Me.Label5.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label5.ForeColor = System.Drawing.SystemColors.WindowText Me.Label5.Location = New System.Drawing.Point(136, 224) Me.Label5.Name = "Label5"
Me.Label5.RightToLeft = System.Windows.Forms.RightToLeft.No Me.Label5.Size = New System.Drawing.Size(136, 17)
Me.Label5.TabIndex = 49
Me.Label5.Text = "Spanningsbron (controle)"
Me.Label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter ' '_lblVolt_5 ' Me._lblVolt_5.BackColor = System.Drawing.SystemColors.Window Me._lblVolt_5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me._lblVolt_5.Cursor = System.Windows.Forms.Cursors.Default Me._lblVolt_5.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me._lblVolt_5.ForeColor = System.Drawing.Color.Blue
Me._lblVolt_5.Location = New System.Drawing.Point(280, 224) Me._lblVolt_5.Name = "_lblVolt_5"
Me._lblVolt_5.RightToLeft = System.Windows.Forms.RightToLeft.No Me._lblVolt_5.Size = New System.Drawing.Size(56, 17)
Me._lblVolt_5.TabIndex = 50 '
'frmStatusDisplay '
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 13) Me.BackColor = System.Drawing.SystemColors.Window Me.ClientSize = New System.Drawing.Size(344, 249) Me.Controls.Add(Me._lblVolt_5) Me.Controls.Add(Me.Label5) Me.Controls.Add(Me._lblADData_5) Me.Controls.Add(Me.TextBox1) Me.Controls.Add(Me.Inlezen) Me.Controls.Add(Me.Vorige) Me.Controls.Add(Me.Volgende) Me.Controls.Add(Me.ComboBox2) Me.Controls.Add(Me.ComboBox1) Me.Controls.Add(Me.Label4) Me.Controls.Add(Me.Label3) Me.Controls.Add(Me.Herbegin) Me.Controls.Add(Me.Label2) Me.Controls.Add(Me.Label1) Me.Controls.Add(Me._lblVolt_3) Me.Controls.Add(Me._lblVolt_2) Me.Controls.Add(Me._lblVolt_1) Me.Controls.Add(Me._lblVolt_4) Me.Controls.Add(Me._lblVolt_0) Me.Controls.Add(Me.cmdQuit) Me.Controls.Add(Me.cmdStartBgnd) Me.Controls.Add(Me.cmdStopConvert) Me.Controls.Add(Me._lblADData_3) Me.Controls.Add(Me.lblChan3) Me.Controls.Add(Me._lblADData_2) Me.Controls.Add(Me.lblChan2) Me.Controls.Add(Me._lblADData_1) Me.Controls.Add(Me.lblChan1) Me.Controls.Add(Me._lblADData_4) Me.Controls.Add(Me.lblChan4) Me.Controls.Add(Me._lblADData_0) Me.Controls.Add(Me.lblChan0)
Me.Font = New System.Drawing.Font("Arial", 8.25!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.ForeColor = System.Drawing.Color.Blue
Me.Location = New System.Drawing.Point(168, 104) Me.Menu = Me.MainMenu1 Me.Name = "frmStatusDisplay" Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual Me.Text = "MiniLAB 1008" Me.ResumeLayout(False) End Sub #End Region
#Region "Universal Library Initialization - Expand this region to change error handling, etc."
Private Sub InitUL()
' Note: Any change to label names requires a change to the corresponding array element below
lblADData = (New System.Windows.Forms.Label() {Me._lblADData_0, Me._lblADData_1, Me._lblADData_2, Me._lblADData_3, Me._lblADData_4, Me._lblADData_5})
lblVolt = (New System.Windows.Forms.Label() {Me._lblVolt_0,
Me._lblVolt_1, Me._lblVolt_2, Me._lblVolt_3, Me._lblVolt_4, Me._lblVolt_5}) ' declare revision level of Universal Library
ULStat =
MccDaq.MccService.DeclareRevision(MccDaq.MccService.CurrentRevNum) ' Initiate error handling
' activating error handling will trap errors like ' bad channel numbers and non-configured conditions. ' Parameters:
' MccDaq.ErrorReporting.PrintAll :all warnings and errors encountered will be printed
' MccDaq.ErrorHandling.StopAll :if any error is encountered, the program will stop
ULStat =
MccDaq.MccService.ErrHandling(MccDaq.ErrorReporting.PrintAll, MccDaq.ErrorHandling.StopAll)
If ULStat.Value <> MccDaq.ErrorInfo.ErrorCode.NoErrors Then Stop
End If
MemHandle = MccDaq.MccService.WinBufAlloc(NumPoints) ' set aside memory to hold data
If MemHandle = 0 Then Stop
End Sub #End Region
Private Sub frmStatusDisplay_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
'************************************************************************** *******
'Vanaf hier enkel code voor communicatie met excel
Private Sub Herbegin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Herbegin.Click
ComboBox1.Text = 0 ComboBox2.Text = 0 Aantal_Inlezen = 0 End Sub
Private Sub Volgende_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Volgende.Click
Dim PinV As Integer Dim UitgangV As Integer PinV = ComboBox1.Text UitgangV = ComboBox2.Text Select Case PinV
PinV = ComboBox1.Text + 10 ComboBox1.Text = PinV Case Else
PinV = 0
ComboBox1.Text = 0 Select Case UitgangV Case 0 To 75 UitgangV = ComboBox2.Text + 25 ComboBox2.Text = UitgangV Case Else UitgangV = 0 ComboBox2.Text = 0 End Select End Select End Sub
Private Sub Vorige_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Vorige.Click
Dim PinV As Integer Dim UitgangV As Integer PinV = ComboBox1.Text UitgangV = ComboBox2.Text Select Case PinV
Case 1 To 100 PinV = ComboBox1.Text - 10 ComboBox1.Text = PinV Case Else PinV = 100 ComboBox1.Text = 100 Select Case UitgangV Case 1 To 100 UitgangV = ComboBox2.Text - 25 ComboBox2.Text = UitgangV Case 0 UitgangV = 100 ComboBox2.Text = 100 End Select End Select End Sub
Dim objApp As Excel.Application Dim objBook As Excel._Workbook Public Aantal_Inlezen As Integer
Private Sub Inlezen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Inlezen.Click
Dim objBooks As Excel.Workbooks Dim objSheets As Excel.Sheets Dim objSheet As Excel._Worksheet Dim range As Excel.Range
If Aantal_Inlezen = 0 Then
' Create a new instance of Excel and start a new workbook. objApp = New Excel.Application
objBooks = objApp.Workbooks 'Conterolee of bestand bestaat
If System.IO.File.Exists(TextBox1.Text) = True Then 'als het bestaat openen
objBook = objBooks.Open(TextBox1.Text) Else
OpenFileDialog1.Title = "Selecteer bestand om data naartoe te lezen"
OpenFileDialog1.InitialDirectory = "c:\Documents and Settings\Student\Mijn Documenten" OpenFileDialog1.Filter = "Excel xls|*.xls" OpenFileDialog1.Multiselect = False OpenFileDialog1.CheckFileExists = True OpenFileDialog1.ValidateNames = True OpenFileDialog1.AddExtension = True OpenFileDialog1.ShowDialog() TextBox1.Text = OpenFileDialog1.FileName
MessageBox.Show("De waarden worden nu opgeslagen in " & OpenFileDialog1.FileName)
End If End If
objSheets = objBook.Worksheets objSheet = objSheets(2)
'Kies juiste rij i.f.v. % Pin en Uitgang % Dim Rij As String
Select Case ComboBox2.Text Case 0
Select Case ComboBox1.Text Case 0 Rij = "P8" Case 10 Rij = "P9" Case 20 Rij = "P10" Case 30 Rij = "P11" Case 40 Rij = "P12" Case 50 Rij = "P13" Case 60 Rij = "P14" Case 70 Rij = "P15" Case 80 Rij = "P16" Case 90 Rij = "P17" Case 100 Rij = "P18" End Select Case 25
Select Case ComboBox1.Text Case 0 Rij = "P25" Case 10 Rij = "P26" Case 20 Rij = "P27" Case 30 Rij = "P28" Case 40 Rij = "P29" Case 50 Rij = "P30" Case 60
Rij = "P31" Case 70 Rij = "P32" Case 80 Rij = "P33" Case 90 Rij = "P34" Case 100 Rij = "P35" End Select Case 50
Select Case ComboBox1.Text Case 0 Rij = "P42" Case 10 Rij = "P43" Case 20 Rij = "P44" Case 30 Rij = "P45" Case 40 Rij = "P46" Case 50 Rij = "P47" Case 60 Rij = "P48" Case 70 Rij = "P49" Case 80 Rij = "P50" Case 90 Rij = "P51" Case 100 Rij = "P52" End Select Case 75
Select Case ComboBox1.Text Case 0 Rij = "P59" Case 10 Rij = "P60" Case 20 Rij = "P61" Case 30 Rij = "P62" Case 40 Rij = "P63" Case 50 Rij = "P64" Case 60 Rij = "P65" Case 70 Rij = "P66" Case 80 Rij = "P67" Case 90 Rij = "P68" Case 100 Rij = "P69" End Select Case 100
Select Case ComboBox1.Text Case 0 Rij = "P76" Case 10 Rij = "P77" Case 20 Rij = "P78" Case 30 Rij = "P79" Case 40 Rij = "P80" Case 50 Rij = "P81" Case 60 Rij = "P82" Case 70 Rij = "P83" Case 80 Rij = "P84" Case 90 Rij = "P85" Case 100 Rij = "P86" End Select End Select
'Get the range where the starting cell has the address
'm_sStartingCell and its dimensions are m_iNumRows x m_iNumCols. range = objSheet.Range(Rij, Reflection.Missing.Value)
range = range.Resize(1, 5) 'Create an array.
Dim saRet(1, 5) As Double 'Fill the array.
Dim iRow As Long Dim iCol As Long For iRow = 0 To 0 For iCol = 0 To 4 Select Case iCol Case 0
saRet(iRow, iCol) = _lblVolt_0.Text Case 1
saRet(iRow, iCol) = _lblVolt_1.Text Case 2
saRet(iRow, iCol) = _lblVolt_2.Text Case 3
saRet(iRow, iCol) = _lblVolt_3.Text Case 4
saRet(iRow, iCol) = _lblVolt_4.Text End Select
Next iCol Next iRow
'Set the range value to the array. range.Value = saRet
'Return control of Excel to the user. If Aantal_Inlezen = 0 Then
objApp.Visible = True
Aantal_Inlezen = Aantal_Inlezen + 1 End If
objApp.UserControl = True 'Clean up a little. range = Nothing objSheet = Nothing objSheets = Nothing objBooks = Nothing End Sub '********************************************** 'Menu 'File => Exit
Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click
Dim ULStat As MccDaq.ErrorInfo
ULStat = MccDaq.MccService.WinBufFree(MemHandle) ' Free up memory for use by other programs
If ULStat.Value <> MccDaq.ErrorInfo.ErrorCode.NoErrors Then Stop End
'objApp.Visible = True End Sub
'Istellingen => Inlezen in
Private Sub MenuItem6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem6.Click
OpenFileDialog1.Title = "Selecteer bestand om data naartoe te lezen"
OpenFileDialog1.InitialDirectory = "c:\Documents and Settings\Student\Mijn Documenten" OpenFileDialog1.Filter = "Excel xls|*.xls" OpenFileDialog1.Multiselect = False OpenFileDialog1.CheckFileExists = True OpenFileDialog1.ValidateNames = True OpenFileDialog1.AddExtension = True OpenFileDialog1.ShowDialog() TextBox1.Text = OpenFileDialog1.FileName
MessageBox.Show("De waarden worden nu opgeslagen in " & OpenFileDialog1.FileName)
End Sub End Class