How can I use an Arduino Mega 2560 to turn on and off 42 separate relays directl

Yes, you can.

As said, read the serial input basics thread linked earlier and use example 3. Test with serial monitor.

Next develop the pc application that gives you a nice user interface that sends the data in the expected format. You can find plenty examples on the web how to control the pc's serial port and send data.