Cannot upload program to Arduino Mega 2560

I am Karthick Ashwath a beginner.I am not able to upload programs to my arduino. I tried everything short of changing the board in troubleshooting.This happenned to me after I connected my Arduino to 6V.
The arduino board is fine,and the uploaded program is working.

What can I do?

Post a link to where you actually bought the board from.

Where did you connect the 6V to?

Try the Loopback test. If that fails, then likely you have damaged the 16U2 that provides the USB/Serial interface for programming. Try it & report back.
If it is damaged, you may be able to use an offboard USB/Serial adapter for downloading code.

Loop back does not work.What pins should I use to connect a serial/USB adapter?Thank you CrossRoads
I welcome any kind of help on this topic as this is my first Arduino and I badly want to repair it.

If loopback test does not work, then likely the 16U2 is damaged and you will not be able to repair it without a hot air rework station.
Get your self an FTDI Basic or equivalent, connect it to D0, D1, +5, Gnd, and see if you can download that way. Will have to press Reset on the board to activate the bootloader when the IDE shows "Compiled xxx of 128xxx bytes".

From your description it does sound like you have blown the USB to serial converter but that the main chip is OK.

You blew it by connecting the wrong voltage so that is your fault.

I suggest you try what Crossroads suggests.

Thank You guys

I need more info on the FTDI basic.Some have 5pins,some have 6.More guidance please?

You need VCC, GND, RX, TX, and DTR.

What should these pins be connected to on the Arduino?

VCC to 5V (Set as 5V on the adaptor) gnd to gnd, TX to RX and RX to TX with DTR to reset.

Thank You Chillitronix
Which TX and RX on the Arduino?1/2/3/0?

I would try 0.

+ChilliTronix
You told me to connect VCC in the FTDI to 5v in the arduino.If it is written as 5v on the FTDI ,could I still connect it to 5v on the arduino?

Yes.

Even that does not work.

Should I get a new board?

/Has you code got three of these ! in it anywhere? Like this !!!

Even using the FTDI does not work

Have you got any exclamation marks (!) in your sketch?