Well I am stumped...
I definitely thought that it was down to indents causing the issue but I have seemingly tried every combination under the sun with no joy.
The script works perfectly as a bare script with no GUI but as soon as I wrap the code inside a Button Click it hangs.
By trial and error and the insertion of a 'MessageBox.Show' at various places along the code I have narrowed it down to the 'While True:' loop
So upon clicking my GUI Button the first part of the function performs as planned, moving the filterwheel to position1 if not already there.
It displays the message that it's capturing LUMINANCE channel and starts to capture.
Here is my first indication of failure because when the working bare script reaches this point SharpCap shows the capture countdown as per normal in the right hand side of the statusbar and the 'Stop capture' button on the toolbar is enabled.
On my GUI script, neither the countdown is displayed or the the 'Stop capture' button enabled.
So like I have stated, by careful placement of a 'MessageBox.Show' directly after the first 'While.True:' I can see that the code never gets past this point and constantly rewrites the 'MessageBox' to the screen, therefore for some reason the 'While True:' is not stepping in to the 'if not SharpCap.SelectedCamera.Capturing :' line and breaking the loop when the 'CaptureLimitValue' is reached.
Here are the section of code, first the working code:
and the non working code: