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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.