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

Post your .Net discussions here
Post Reply
evh
Newbie
Posts: 0
Joined: Thu Aug 23, 2012 1:51 am

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

Post by evh »

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

Hitesh

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

Post by Hitesh »

Hi EVH,

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

Thanks,

Post Reply