The first question I have concerning your problem is your video card and it's settings. There are a couple of 'known issues' regarding certain NVidia cards and the use of DVI. While you have your display hooked up via VGA go into the display properties area and make sure that the settings are set to the lowest settings available especially your 'Refresh Rate'. Reduce to 60Mhz if that is possible for your brand of monitor. Once you have lowered the settings, turn the system off and then connect the DVI cable. BEFORE re-starting you pc find and start to tap the F5 key or what ever function key allows your system to boot up into safe mode.
Once you are in safe mode click go to START > RUN in the run dialog box type in 'dxdiag.exe.
This small windows diagnostic program will check to make sure you don't have any directx issues.
Once the dx diagnostic is finished turn off your computer (still using the VGA cable) then do the following:
a) Plug in both dvi and vga cable into video card and monitor
b) Turn on computer (boot to windows fully)
c) Shut down computer
d) Unplug VGA cable
e) Leave DVI alone
f) Unplug monitor 10 sec
g) Turn on computer
Sounds like a silly little exercise I know, however the seemingly strange solution has worked for a great many people experiencing the same issue that faces you.
You question does not state whether you use a PC or a Mac. If you are a Mac user and are having this issue do the following as there is also known DVI issues that involve the Mac G4, Power Mac G5 restarting continually after connecting the DVI. In this case;
This occurs when certain third-party VGA and DVI displays are connected to the computer's digital video interface (DVI) port. This does not affect displays that use the Apple Display Connector (ADC). If your computer restarts after shutdown or wakes after being put to sleep with certain displays connected to the DVI port, these symptoms can be prevented by connecting the display to the video card's ADC port instead of the DVI port.
It may be necessary to purchase an ADC to VGA or ADC to DVI adapter cable.
Once you have an adapter:
1. Disconnect the display and any adapters from the DVI port on the back of the computer.
2. Connect the appropriate ADC to VGA or ADC to DVI adapter to the ADC port on the back of the computer.
3. Connect the display to the adapter cable.
4. Turn on the computer and verify that it starts up correctly.
5. Choose Shut Down or Sleep from the Apple menu and verify that the computer responds correctly.