how to make a program run when an external device is plugged in???(program run from the computer not an autorun from the flash)

What operating system do you use ?

CrazyDieter is right. This is not a language question. Every operating system has special functions which tell you about devices, and they are different for every system.
In Windows, the functions for managed code in the .NET framework are different from the ones you use with regular code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.