I've been trying the last couple hours to understand and apply the "Progress Bar" and the "background worker".
I have to functions wich take..
The first one takes one argument wich is the combobox1.text.
The other one takes two : (combobox1.text,combobox2.text).
The first Function is :
public void CopyDirectory(string strSource, string strDestination)
string strDestinationFile = string.Empty;
DirectoryInfo Dirinfo = new DirectoryInfo(strSource);
foreach (FileSystemInfo filesInfo in Dirinfo.GetFileSystemInfos())
strDestinationFile = Path.Combine(strDestination, filesInfo.Name);
if (filesInfo is FileInfo)
File.Copy(filesInfo.FullName, strDestinationFile, true);
The second one is:
public static long DirSize(DirectoryInfo d)
long size = 0;
FileInfo fis = d.GetFiles();
foreach (FileInfo fi in fis)
size += fi.Length;
DirectoryInfo dis = d.GetDirectories();
foreach (DirectoryInfo di in dis)
size += DirSize(di);
I didn't included the code for the progressbar value update in the code block as it's unimportant for now..
Since background worker can't access the control of the forms how am i supposed to implement these two functions i got in it ??
Thanks in advance, Stelios K.