
Public Class Form1
    Dim wRtn As UInt16
    Public wTotalBoards As UInt16
    Dim sGetCardInfo As IXUD_CARD_INFO
    Dim sGetDevInfo As IXUD_DEVICE_INFO
    Dim wBoardNo As UInt16
    
    Dim wBoardNo_DA4U_A As Integer
    Dim wBoardNo_DA4U_B As Integer


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       
        '//Driver Initial
        wRtn = Ixud_DriverInit(wTotalBoards)
        If (wRtn) Then
            MsgBox("Driver Initial Error!!Error Code:" + Str(wRtn))
            End
        End If

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
        wRtn = UniDAQ.Ixud_DriverClose()
        Me.Close()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnActive.Click
        'A
        Dim lInputVal As Long
        '// Get BoardNo for PISO-DA4U
        wRtn = Ixud_GetBoardNoByCardID(wBoardNo_DA4U_A, PIODA, CInt(Me.tbxCardIDA.Text))
        'PIODA
        If (wRtn) Then
            MsgBox("GetBoardNoByCardID Error!!Error Code:" + CStr(wRtn))
        End If

        '//Write Digital Output port
        '//Read Digital Input port
        wRtn = Ixud_WriteDO(wBoardNo_DA4U_A, CInt(Me.tbxAPort.Text), 10) 'A
        wRtn = Ixud_ReadDI(wBoardNo_DA4U_A, CInt(Me.tbxAPort.Text), lInputVal)

        Me.tbxAVal.Text = Hex(lInputVal)
        Me.BoardNo1.Text = wBoardNo_DA4U_A
    End Sub

    Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'B
        Dim lInputVal As Long

        '//GetBoardNo for PISO-DA4U
        wRtn = Ixud_GetBoardNoByCardID(wBoardNo_DA4U_B, PIODA, CInt(Me.tbxCardIDB.Text))
        'PIODA
        If (wRtn) Then
            MsgBox("GetBoardNoByCardID Error!!Error Code:" + CStr(wRtn))
        End If

        '//Write Digital Output port
        '//Read Digital Input port
        wRtn = Ixud_WriteDO(wBoardNo_DA4U_B, CInt(Me.tbxBPort.Text), 11) 'B
        wRtn = Ixud_ReadDI(wBoardNo_DA4U_B, CInt(Me.tbxBPort.Text), lInputVal)

        Me.tbxBVal.Text = Hex(lInputVal)
        Me.BoardNo2.Text = wBoardNo_DA4U_B

    End Sub

  
End Class
