vb.net loop running next too fast -


i have code in vb application:

    each fi in aryfi         if system.io.file.exists(fi.fullname) = true             textbox2.text = textbox2.text + "file: " + fi.name + vbcrlf             textbox2.refresh()              textbox2.text = textbox2.text + "printing file" + vbcrlf             textbox2.refresh()             ' create object, passing in text             dim psi new processstartinfo             psi.useshellexecute = true             psi.verb = "print"             psi.windowstyle = processwindowstyle.hidden             psi.filename = fi.fullname              dim p = process.start(psi)              textbox2.text = textbox2.text + "moving file" + vbcrlf             textbox2.refresh()             system.io.file.move(my.settings.folderpath + "\" + fi.name, my.settings.folderpath + "\completed\" + fi.name)             textbox2.text = textbox2.text + vbcrlf + vbcrlf + "------------------------------------------------------------" + vbcrlf             textbox2.refresh()              p.waitforexit()          end if     next 

it loops through directory of files , prints each file individually.

once has printed file, moves directory not processed again.

it seems that, running next loop before file has been moved trying print same file on , on again

how can stop happening


Comments