c# - exit with escape key in for loop -


i have loop , working :

  (int x = 0; x < nombres.length; x++)             {                 validxx.text = x.tostring(); validxy.text = nombres.length.tostring();                  origen = nombres[x];                 cambia = nombres[x];                 pedrito = control.validardocumentoxml(cambia);                 if (pedrito == true)                 { }                 else                   /*  file.move (origen , destino );*/                 try                 { }                 catch(ioexception iox)                 {  messagebox.show(iox.message); }                 { /* corrupto[x] = cambia; */ messagebox.show("malo" + cambia); }             }  

i want o break loop escape key , have try :

    private void importar2_keydown(object sender, keyeventargs e)     {         if (e.keycode == keys.escape) { }        } 

but can not write key_down loop.

you this:

    bool escpressed = false;          ....         //run loop in different thread         thread thread = new thread(new threadstart(myloop));         thread.start();         ....               void myloop()     {         (int x = 0; x < nombres.length; x++)         {             if(escpressed) break;             validxx.text = x.tostring(); validxy.text = nombres.length.tostring();              origen = nombres[x];             cambia = nombres[x];             pedrito = control.validardocumentoxml(cambia);             if (pedrito == true)             { }             else               /*  file.move (origen , destino );*/             try             { }             catch(ioexception iox)             {  messagebox.show(iox.message); }             { /* corrupto[x] = cambia; */ messagebox.show("malo" + cambia); }         }      }      private void importar2_keydown(object sender, keyeventargs e)     {         if (e.keycode == keys.escape) { escpressed = true;}        } 

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -