Communicating PC to Arduino Mega 2560 through serial

If this code works with putty or the serial monitor then your error is in the LabView bit which you have not posted.