K8055 withVisual Basic 4 - ClearDigitalChannel Help

Hi
I have my board running ok. Demo1.frm works ok.
I have limited VB4 experience.
I am trying to write a routine that will selectivly toggle the outputs on/off.
A routine to test the idea on just channel 1 follows .
When run it sets output 1 on when I depress input switches 1 &4.
If I hold the switches down the value of D(1) toggles from 1 to 0 ok but the channel fails to clear.
What am I doing wrong?

Private Sub timePollInputs_Timer()
    timePollInputs.Enabled = False
    DInsData = ReadAllDigital
    Select Case DInsData
      Case Is = 9
      Debug.Print DInsData, D(1)
        If D(1) = 0 Then
          D(1) = 1: SetDigitalChannel (D(1))
        Else
          D(1) = 0: ClearDigitalChannel (D(1))
          'D(1) changes to 0 but Channel does not clear
        End If
      
    End Select
    timePollInputs.Enabled = True
End Sub

It seems that you set channel number 1 but you clear channel number 0.

D(1) = 1: SetDigitalChannel (D(1)) Else D(1) = 0: ClearDigitalChannel (D(1))

Of Course!
I changed my variable names to DoutNo and DoutData(1)
Thank You