Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can't figure out why ArrayList.RemoveAt() is not working
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Can't figure out why ArrayList.RemoveAt() is not working
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2008 Server
Application:
Desktop
Divers
Thread ID:
01519460
Message ID:
01519460
Vues:
83
I am currently using Florian Leitner's HID USB library in my VB.NET solution for communicating with a pin pad. As per his sample code, I set up an event handler to handle incoming responses from the device which are stored in an ArrayList called usbBuffer:
    Private Sub BufferEventHandler(ByVal sender As Object, ByVal e As System.EventArgs)

        If USBInterface.usbBuffer.Count > 0 Then

            While USBInterface.usbBuffer(0) Is Nothing

                SyncLock USBInterface.usbBuffer.SyncRoot

                    USBInterface.usbBuffer.RemoveAt(0)

                End SyncLock

            End While

            _receiveArray = CType(USBInterface.usbBuffer(0), Byte())

            _usbInterface.stopRead()

            SyncLock USBInterface.usbBuffer.SyncRoot

                USBInterface.usbBuffer.RemoveAt(0)

            End SyncLock

        End If

    End Sub
The problem is that the RemoveAt is not working, since the first element in the list remains there after the handler is done. Could someone please advise as to what I've done wrong, or perhaps use a different approach?
Jon Rosenbaum
Devcon Drummer
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform