Hi there. Hope someone can help!

I kind of know how to make a progress bar but I do not know how it will work for this...

Basically, my app checks for an update on the net. if there is, it will download it. It writes that download to a memory stream then to file stream.
it gets the length of bytes from the update website... it then writes that to the memory stream to construct the file.

during this process, how can i make a progress bar on how much it has progressed throughout the entire procedure?

Code:
MemoryStream fileMemoryStream = new MemoryStream();
DirectoryInfo dirInfo = new DirectoryInfo(theLinkToFilePath);
string theFileNameOfUpdate = theLinkToFilePath.Substring(theLinkToFilePath.LastIndexOf("/") + 1);
string theDirsToCreate = theLinkToFilePath.Substring(0, theLinkToFilePath.LastIndexOf("/"));
			
Directory.CreateDirectory(currentClientStartupPath + @"\" + theDirsToCreate);
FileStream theFileStream = new FileStream(currentClientStartupPath + "\\" + theDirsToCreate + @"\" + theFileNameOfUpdate, FileMode.Create, FileAccess.ReadWrite);
int len = (int)theWebUpdateObject.GetFileLen(theLinkToFilePath);
Byte[] theByteArray = new byte[len];
theByteArray = theWebUpdateObject.SendFileToClient(theLinkToFilePath);

fileMemoryStream.Write(theByteArray, 0, len);
fileMemoryStream.WriteTo(theFileStream);
theFileStream.Close();
fileMemoryStream.Close();
that is pretty much how to gets and writes the file... during that i would like the progress bar to show the progress.

how can it be done?