The door latch pulls the door tightly closed to prevent water leakage around the door. It is also designed to prevent operation while the door is open. The door latch works in concert with the door switch to ensure that the door is tightly closed and latched.
The door switch is a separate part from the door latch and is found inside the cabinet. The switch is off when the door is open. Depressing the switch closes the circuit and enables dishwasher operation. Closing the door does not depress the switch all the way. Only when the door is closed and latched, does the door fully depress the switch.
If the door latch is not properly aligned it may not pull the door tightly closed and the door switch will not be fully depressed. Unless the switch is fully depressed the dishwasher will not operate.
It is a simple matter to determine whether the door latch is the problem. Simply open the door, close the latch and select a cycle and depress the switch. Note that if the test is successful, with the door open, the dishwasher will operate and water may spray out. Make sure to first remove all tools from inside the dishwasher. Do not reach inside the dishwasher during the test. Now, inspect the cabinet where the door makes contact with it and locate the door switch. It may have a protruding button or spike or more likely it is a hole with a piece of metal or plastic inside it. You must fully depress that switch. If the switch is recessed, then use a non-conductive object, such as a wooden pencil, to depress the switch.