Hallo,

Ik heb volgende Visual Basic code:


Public Class Form1

    Private Declare Function OpenDevice Lib "k8055d.dll" (ByVal CardAddress As Long) As Long
    Private Declare Sub CloseDevice Lib "k8055d.dll" ()
    Private Declare Function ReadAnalogChannel Lib "k8055d.dll" (ByVal Channel As Long) As Long
    Private Declare Sub ReadAllAnalog Lib "k8055d.dll" (ByVal Data1 As Long, ByVal Data2 As Long)
    Private Declare Sub OutputAnalogChannel Lib "k8055d.dll" (ByVal Channel As Long, ByVal Data As Long)
    Private Declare Sub OutputAllAnalog Lib "k8055d.dll" (ByVal Data1 As Long, ByVal Data2 As Long)
    Private Declare Sub ClearAnalogChannel Lib "k8055d.dll" (ByVal Channel As Long)
    Private Declare Sub SetAllAnalog Lib "k8055d.dll" ()
    Private Declare Sub ClearAllAnalog Lib "k8055d.dll" ()
    Private Declare Sub SetAnalogChannel Lib "k8055d.dll" (ByVal Channel As Long)
    Private Declare Sub WriteAllDigital Lib "k8055d.dll" (ByVal Data As Long)
    Private Declare Sub ClearDigitalChannel Lib "k8055d.dll" (ByVal Channel As Long)
    Private Declare Sub ClearAllDigital Lib "k8055d.dll" ()
    Private Declare Sub SetDigitalChannel Lib "k8055d.dll" (ByVal Channel As Long)
    Private Declare Sub SetAllDigital Lib "k8055d.dll" ()
    Private Declare Function ReadDigitalChannel Lib "k8055d.dll" (ByVal Channel As Long) As Boolean
    Private Declare Function ReadAllDigital Lib "k8055d.dll" () As Long
    Private Declare Function ReadCounter Lib "k8055d.dll" (ByVal CounterNr As Long) As Long
    Private Declare Sub ResetCounter Lib "k8055d.dll" (ByVal CounterNr As Long)
    Private Declare Sub SetCounterDebounceTime Lib "k8055d.dll" (ByVal CounterNr As Long, ByVal DebounceTime As Long)


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        If OpenDevice(0) = 0 Then

            MsgBox("Succesvol geconnecteerd!")

        End If

    End Sub

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

        Timer1.Interval = 1000
        Timer1.Start()

    End Sub


    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

        Dim Deur As Boolean
        Deur = ReadDigitalChannel(1)
        If Deur = False Then
            MsgBox("Open")


        End If

    End Sub


End Class

Het probleem is als de deur dan open gaat (dus Deur = False) dan blijft de MsgBox komen. Hoe kan ik ervoor zorgen dat deze box maar één keer opengaat???