cpopham Posted June 30, 2006 Posted June 30, 2006 I am looping thought all of the files in a directory. Easy enough, now I am putting the file name of each file in a textbox for my user to check as the loop goes through each file. After the user verifies the file, they press a button to continue to the file in the loop. My question is, how can I get my loop to stop at each file after putting the file info in the textbox and then waiting for my user to click OK. I guess I want the loop to pause when it gets to the user verification point and then resume when the user presses the button. Any ideas? Thanks, Chester Quote ____________________________________________ http://www.pophamcafe.com I am starting a developers section, more tutorials than anything.
mskeel Posted June 30, 2006 Posted June 30, 2006 A message box might be one way you could do this. 'This is a blocking call If MessageBox.Show("Do you want this file?", "Well, do you?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then MessageBox.Show("Keep the file!") Else MessageBox.Show("Ditch the file!") End If ... Quote
Leaders snarfblam Posted June 30, 2006 Leaders Posted June 30, 2006 You can also create your own intermediate form and call the ShowDialog function of that form, which pauses execution on the calling thread until the form is hidden or closed. A third option would be a multithreaded approach, where you could load all the files on a secondary (non-gui) thread and for each file, block the thread until the user clicks OK for each file. At this point, though, there would also be single-threaded options that could also provide the same functionality. Quote [sIGPIC]e[/sIGPIC]
cpopham Posted July 2, 2006 Author Posted July 2, 2006 I think what I am going to do is either use a hidden list box or an array that contains will store the file names. I will then have a module level variable that will keep track of the file that is currently being check. When the user clicks okay for the file, I will have the sub get the current count from the vairable, add one to it and then go to that file. I think that may be the most simple way of implementing it. Thanks for the help guys! Chester Quote ____________________________________________ http://www.pophamcafe.com I am starting a developers section, more tutorials than anything.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.