Windows Develop Bookmark and Share   
 index > Windows Forms Sample Applications > Timer with copy 'job'
 

Timer with copy 'job'

I'm working on a project that needs to copy from 1 directory 10MB to a second directory (second directory is created in earlear code by combining textboxes and strings, this works fine)

When I start a timer befor copying for a progres bar that increases the value every 25 ms it wil only start with the timer after de copy ' job' is done but the ENABLE timer is given before the copy job, is there a way to use the progress bary while copying data..?

Thanks!

(Sorry for my bad english.. I'm a Dutch one!)

Robbin AB-SYSTEMS  Tuesday, February 06, 2007 12:13 PM

Hi, Robbin AB-SYSTEMS

There's a piece of code for your information:

void readFiles()

{

// Sets the progress bar's minimum value to a number

// representing the hard disk space before the files are read in.

// You will most likely have to set this using a system call.

// NOTE: The code below is meant to be an example and

// will not compile.

progressBar1.Minimum = AvailableDiskSpace();

// Sets the progress bar's maximum value to a number

// representing the total hard disk space.

// You will most likely have to set this using a system call.

// NOTE: The code below is meant to be an example

// and will not compile.

progressBar1.Maximum = TotalDiskSpace();

// Uses a for loop to iterate through the operations to be

// completed. In this case, five files are to be written

// to the disk, so it will execute the loop 5 times.

for (int i = 1; i<= 5; i++)

{

// Insert code to read a file into memory and update file size.

// Increases the progress bar's value based on the size of

// the file currently being written.

progressBar1.Increment(FileSize);

// Updates the label to show available drive space.

label1.Text = "Current Disk Space Used = " + progressBar1.Value.ToString();

}

}

Hope it helps.
Best Regards.
Ye

Zhi-Xin Ye  Wednesday, February 07, 2007 5:48 AM

Unfortunaly the diskspace is not a thing to work on, there are a 30 other peoples that or working on that same disk so that will increase also when copien wil not be don (errors or something..)

Best regard Robbin

Robbin AB-SYSTEMS  Wednesday, February 07, 2007 11:24 AM

You can use google to search for other answers

Custom Search

More Threads

• IssueList outlook control
• Showing C# Intellisense in TextBox
• Display Detail Grid in Combobox Control
• How to change visualization of WMP?
• Help using a DLL Assembly with Windows Form
• Problem updating Manifest-file.
• server side config
• Error in terrarium example code?
• INameSpaceTreeControl can be resized?
• Errors installing Server (System.IO.FileNotFoundException)