Test and Measurement Forum

Cant Get This code to work .... please help

Post your .Net discussions here

Cant Get This code to work .... please help

Postby evh » Thu Aug 23, 2012 1:57 am

Code: Select all

Imports System.Runtime.InteropServices

Public Class Form1

    Declare Function usb_tc08_open_unit Lib "usbtc08.dll" () As Short
    Declare Function usb_tc08_get_unit_info Lib "usbtc08.dll" (ByVal handle As Short, ByRef info As tUSBTC08Info) As Short
    Declare Function usb_tc08_get_single Lib "usbtc08.dll" (ByVal handle As Integer, ByRef temp As Single, ByRef overflow_flags As Integer, ByVal units As Integer) As Long




      Structure tUSBTC08Info
        Public size As Short
        Public DriverVersion As Short
        Public PicoppVersion As Short
        Public HardwareVersion As Short
        Public picovar As Short
        Public szSerial As String
        Public szCalDate As String
    End Structure

    Public info As tUSBTC08Info

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim handle As Short = usb_tc08_open_unit()
        MessageBox.Show(handle)
        'info.size = Marshal.SizeOf(info)
        Dim infook As Short = usb_tc08_get_unit_info(handle, info)
        MessageBox.Show(infook)

    End Sub



   
    Private Sub getUSBTC08()
        Dim unitResult As Long
        Dim handle As Integer = 1
        Dim tempReadings(9) As Single
        Dim ofFlag As Integer
        Dim tempUnits As Integer = 1
       

        For n = 0 To 8
            unitResult = usb_tc08_set_channel(handle, n, "K")

            Debug.Print(unitResult)
        Next


        unitResult = usb_tc08_get_single(handle, tempReadings(0), ofFlag, tempUnits)
        Debug.Print(unitResult & " " & ofFlag)

        For n = 0 To 8
            Debug.Print(tempReadings(n))
        Next

    End Sub


End Class
evh
Newbie
 
Posts: 0
Joined: Thu Aug 23, 2012 1:51 am

Re: Cant Get This code to work .... please help

Postby Hitesh » Thu Aug 23, 2012 3:50 pm

Hi EVH,

Could you please state which function call/line of code is causing the issue.

Thanks,
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 2058
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire


Return to .Net Languages (C#, VB.Net, .)

Who is online

Users browsing this forum: No registered users and 0 guests