fungus:
Henry_Best:
Do I need a DPDT switch on just the D+ and D- lines to switch between them?Yes.
Done that. Thanks.
Henry_Best:
Or, if all four USB lines are connected to both, will the IDE detect the correct Arduino if I select (in the IDE), say, the Uno to upload to?No. You can't have two devices trying to drive a piece of wire simultaneously.
That's not quite what I meant. If I tell the IDE to upload to the Mega (in Boards), will it ignore the Uno and just upload to the Mega and vice versa? As I said, it seems unlikely. But I've put in a DPDT switch now and I'll test it tomorrow, after I've reassembled the box.