Hi guys,

I have a program that searches a large quantity of files and performs tasks on the files.

can anyone tell me how to do the following:

I want to create a "Searching" window that pops up with a loading bar on it. i want the main window to lock so no buttons can be clicked and the "Searching" window remains on the screen until all files have been found. once the process finishes. the box disapears and the main window unlocks again .

many thanks in advance,

Hypehs

Hi, you have to create a new Form. Create a method which would start the searching.
Before search begins, start a new thread (so the main one will not be busy while searching). Then create a progressBar, which would show the progress (loading bar).

Somehow you have to figue out what are you searching so, you can define the max lenght of the progreeBar (if not, you will not be able to show procentages; from 0 to 100%).

With the use of Delegates you can update the loading bar (with some label maybe -showing procentages) on the form. Thats about it.
Or instead of creating a new Thread, you can use BackgroundWorker.

Mitja

Hi,

thanks for the reply.

it will be searching a different number of files every time its run so i cant give a set number for the Percentage. so does that mean its not possible to use a loading bar?

if not its fine.

is it possible to get a counter set, so every time a file is found, the label ticks up?

Regards,
Hypeh

You can use a progresBar (you call it loading bar). But it will not be set that the user will see when it will stop. It will just move.

What is the "Counter set"?

Edited 5 Years Ago by Mitja Bonca: n/a

This article has been dead for over six months. Start a new discussion instead.