The easiest method is just to insert a ProcessSystemEvents() call in your while loop. This will slow the loop down some, but it will allow the processing of any user interface events if they occur. If this slight slow down is not acceptable, you would need to look into multithreaded programming.
Best Regards,
Chris Matthews
National Instruments