[Gambas-user] Breaking processes

Dimitris Anogiatis dosida at ...626...
Wed Nov 4 12:54:51 CET 2009


 Hey M,

to stop the execution of a for loop all you have to do is check for a
condition then use break

for example


PUBLIC SUB FCopy()
DIM i AS Integer
Dim stopLoop as Boolean
DIM filepaths AS String[]
........................' the array filepaths is filled with contents
FOR i=0 To filepaths.Count-1

if stopLoop = False THEN
   SHELL "cp -f  " & filepaths[i] & " /home/destination"
Else
   BREAK
ENDIF
NEXT

I hope this helps

Regards,
Dimitris

On Wed, Nov 4, 2009 at 3:41 AM, M. Cs. <mohareve at ...626...> wrote:

> How can I stop the execution of a loop which includes shell command for
> copying files?
>
> Example:
> PUBLIC SUB FCopy()
> DIM i AS Integer
> DIM filepaths AS String[]
> ........................' the array filepaths is filled with contents
> FOR i=0 To filepaths.Count-1
> SHELL "cp -f  " & filepaths[i] & " /home/destination"
> NEXT
>
> END
>
> I'd like to add a Cancel button which would break the loop.Thanks!
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list