You can wire a tab control to a case structure and put the code associated with each tab in its repective case. If the code inside the case structure is a loop, you first need to stop the loop and exit that case. On the next read of the loop your tab control is in, the case structure will run the case that is associated with the tab selected.