VB.NET - How to Lock the Object in VB.NET - Asked By Nani gd on 03-Aug-12 11:42 AM

Hi Experts,

I want to lock the object of a class.
i have written a code like :

          Dim objLock As New Object
              SyncLock objLock
                Show(data, False)
              End SyncLock

as soon as show method is being executed, some of my background threads are changing data.
so that i am getting error.
to prevent that from what should i do..
help me..
Thanks in advance..

Regards,
Nani
Peter Bromberg replied to Nani gd on 04-Aug-12 02:07 PM
Use the Lock method, not SyncLock