If I detect a USB device, unplug it, and then try to write to the device WriteFile causes an exception in VB.net. If I run the same code in VC++ it returns WriteFile as false as it should. Why does the function work differently in one language than the other? How do I get WriteFile to return as false in VB.net if a USB device is suddently unplugged?