A few more comments:
You don't need an event structure in a seperate loop, I would use a simple shift register for the boolean as in the attached image to see if the value has changed.
Also (see image):
- You should not create a new visa session from scratch at every iteration, you can do it once outside the loop.
- many of your formatting and comparison operations can be simplified significantly.
- You only check once for errors, then switch three different sequential case structures with the same boolean. This is equivalent of combining the three cases into one. You should check for new errors after each case structure. This is easiest done by wiring the error cluster to the case selector terminal.
- There probably should be a small wait statement in the loop so it plays nice.
I'm sure the code will run much better this way.