P8047 Interface card communication problem

I have a strange problem with the P8047 card and I would appreciate it if some one could explain where I am going wrong.
In order to learn VB I have tried to write my own interface program rather that just copy the demo supplied. However If I try to run my program in debug mode it does not communicate with the card, yet if I run the supplied demo program first and then switch back to my program it works fine. It seems that I am missing an initialisation command.
I have copied my basic program below:
The declarations are copied from the demo program.

Public Class Form1
    
    'GENERAL PROCEDURES
    Private Declare Sub StartDevice Lib "k8047d.dll" ()
    Private Declare Sub StopDevice Lib "k8047d.dll" ()

    'INPUT PROCEDURE
    Private Declare Sub ReadData Lib "k8047d.dll" (ByRef ArrayPointer As Integer)

    'OUTPUT PROCEDURE
    Private Declare Sub SetGain Lib "k8047d.dll" (ByVal ChannelNo As Integer, ByVal Gain As Integer)
    Private Declare Sub LEDon Lib "k8047d.dll" ()
    Private Declare Sub LEDoff Lib "k8047d.dll" ()

    'declare variables
    Dim DataBuffer(0 To 7) As Integer
    Dim CH1 As Integer
    Dim CH2 As Integer
    Dim CH3 As Integer
    Dim CH4 As Integer


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

    Private Sub Form1_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
        StopDevice()
    End Sub
    
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        LEDon()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        LEDoff()
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Timer1.Enabled = True
        LEDon()


        'ListBox1.Items.Add(Str(CH1))



    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        LEDon()
        ReadData(DataBuffer(0))
        CH1 = DataBuffer(2)
        CH2 = DataBuffer(3)
        CH3 = DataBuffer(4)
        CH4 = DataBuffer(5)
        Label2.Text = CH1
        Label4.Text = CH2
        Label6.Text = CH3
        Label8.Text = CH4
        LEDoff()

    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Timer1.Enabled = False
        LEDoff()

    End Sub

    Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
        SetGain(1, 1)
    End Sub

    Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
        SetGain(1, 2)
    End Sub

    Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
        SetGain(1, 5)
    End Sub

    Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged
        SetGain(1, 10)
    End Sub

    Private Sub RadioButton5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton5.CheckedChanged
        Timer1.Interval = 1000

    End Sub

    Private Sub RadioButton6_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton6.CheckedChanged
        Timer1.Interval = 2000
    End Sub

    Private Sub RadioButton7_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton7.CheckedChanged
        Timer1.Interval = 5000
    End Sub

    Private Sub RadioButton8_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton8.CheckedChanged
        Timer1.Interval = 500

    End Sub
    
End Class

The problem may be that your program doesn’t find all the K8047 files.
Please copy the following files to your VB application’s subfolder \bin\Debug:
K8047D.dll
K8047e.exe
FASTTime32.dll

You’ll find these files from the same subfolder of the demo program.

Thank you, I had not copied the files as you suggested. I had them in the system32 folder but not the applications debug folder.

It seems that all the accompanying files must be in the same folder with the application .EXE file.