hi, I got a form decompressing zip file using windows form C# & I would really like to add a ProgressBar to it, but unfortunately I have no idea how to write code that connects the ProgressBar to my decompress code to show the progress. I use a TextBox named txtsource to show the path of desired file, a button called btnbrowse to select the desired file & another button as btnextract to commence the decompression proccess.
here are my codes:
using System.IO;
using System.IO.Compression;
private void btnsource_Click(object sender, EventArgs e)
{
DialogResult result = openFileDialog1.ShowDialog();
if (result == DialogResult.OK)
{
txtsource.Text = openFileDialog1.FileName;
}
}
private void btnextract_Click(object sender, EventArgs e)
{
txtsource.Text = openFileDialog1.FileName;
DialogResult result2 = folderBrowserDialog1.ShowDialog();
if (result2 == DialogResult.OK)
{
System.IO.Compression.ZipFile.ExtractToDirectory(openFileDialog1.FileName, folderBrowserDialog1.SelectedPath);
MessageBox.Show("Zip package has been extracted to\n" + txtsource.Text, " package extraction proccess Successfull!", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
What I have tried:
Well franckly, I really know little about ProgressBar & so far the articles I read to fix my problems weren't useful & I need to say that I'm a rookie programmer, so I would really appreciate your help. Thank you.