|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
break statement equivalent in VB?Need to quickly write a test app in VB, and this involves porting some
C++ code to VB6. I can't seem to find an equivalent of the break statement - specifically, to allow me to break out of a WHILE loop (without having to resort to 'goto' etc) - whats the equivalent in VB? Frank Moyles schrieb:
> Need to quickly write a test app in VB, and this involves porting some None.> C++ code to VB6. I can't seem to find an equivalent of the break > statement - specifically, to allow me to break out of a WHILE loop > (without having to resort to 'goto' etc) - whats the equivalent in VB? Use GoTo, If or Select Case. Functionally break is a GoTo. MfG, Alex In article <474d39be$0$13111$9b4e6***@newsspool2.arcor-online.net>,
mille***@hotmail.com (Alexander Mueller) wrote: Show quote > *From:* Alexander Mueller <mille***@hotmail.com> Use a Do....Loop instead and then you can break out of it with 'Exit Do'.> > Frank Moyles schrieb: > > Need to quickly write a test app in VB, and this involves porting > > some C++ code to VB6. I can't seem to find an equivalent of the > > break statement - specifically, to allow me to break out of a > > WHILE loop (without having to resort to 'goto' etc) - whats the > > equivalent in VB? > > None. > Use GoTo, If or Select Case. > Functionally break is a GoTo. > > MfG, > Alex > Regards John (john@jeasonNoSpam.cix.co.uk) Remove the obvious to reply... John K.Eason schrieb:
Show quote > In article <474d39be$0$13111$9b4e6***@newsspool2.arcor-online.net>, Oups sorry i mixed up continue and break.> mille***@hotmail.com (Alexander Mueller) wrote: > >> *From:* Alexander Mueller <mille***@hotmail.com> >> >> Frank Moyles schrieb: >>> Need to quickly write a test app in VB, and this involves porting >>> some C++ code to VB6. I can't seem to find an equivalent of the >>> break statement - specifically, to allow me to break out of a >>> WHILE loop (without having to resort to 'goto' etc) - whats the >>> equivalent in VB? >> None. >> Use GoTo, If or Select Case. >> Functionally break is a GoTo. >> >> MfG, >> Alex >> > > Use a Do....Loop instead and then you can break out of it with 'Exit Do'. Break of course exists in VB as "Exit For" or "Exit Do". Thanks for the correction. MfG, Alex On Wed, 28 Nov 2007 10:49:51 +0100, Alexander Mueller
<mille***@hotmail.com> wrote: >Frank Moyles schrieb: Exit Do>> Need to quickly write a test app in VB, and this involves porting some >> C++ code to VB6. I can't seem to find an equivalent of the break >> statement - specifically, to allow me to break out of a WHILE loop >> (without having to resort to 'goto' etc) - whats the equivalent in VB? > >None. >Use GoTo, If or Select Case. >Functionally break is a GoTo. > >MfG, >Alex and Exit For are both able to do what you want. You can also prematurely end a function with the exit statement. PeterD schrieb:
Show quote > On Wed, 28 Nov 2007 10:49:51 +0100, Alexander Mueller Thx for correcting me, i thought of 'continue', where there is> <mille***@hotmail.com> wrote: > >> Frank Moyles schrieb: >>> Need to quickly write a test app in VB, and this involves porting some >>> C++ code to VB6. I can't seem to find an equivalent of the break >>> statement - specifically, to allow me to break out of a WHILE loop >>> (without having to resort to 'goto' etc) - whats the equivalent in VB? >> None. >> Use GoTo, If or Select Case. >> Functionally break is a GoTo. >> >> MfG, >> Alex > > Exit Do > > and > > Exit For > > are both able to do what you want. > > You can also prematurely end a function with the exit statement. no equivalent in VB. MfG, Alex In article <OJidnbhZQpWgt9DanZ2dnUVZ8uCdn***@bt.com>,
fgmoyles@nospam.com says... > Need to quickly write a test app in VB, and this involves porting some "Exit Do"> C++ code to VB6. I can't seem to find an equivalent of the break > statement - specifically, to allow me to break out of a WHILE loop > (without having to resort to 'goto' etc) - whats the equivalent in VB? "Exit For" .... -- Remove the ns_ from if replying by e-mail (but keep posts in the newsgroups if possible). "Frank Moyles" <fgmoyles@nospam.com> wrote in message As already stated, While/Wend is ancient syntax; avoid it. Use Do/Loop news:OJidnbhZQpWgt9DanZ2dnUVZ8uCdnZ2d@bt.com... > Need to quickly write a test app in VB, and this involves porting some C++ > code to VB6. I can't seem to find an equivalent of the break statement - > specifically, to allow me to break out of a WHILE loop (without having to > resort to 'goto' etc) - whats the equivalent in VB? instead because it gives you Exit Do. The only time you need GoTo is if you need the equivalent of C's continue statement, because VB has no such thing, unfortunately. |
|||||||||||||||||||||||