Hello. I have a program which processes some files when the user clicks a
button. My 1st class is based on a Form object. When the user clicks on a
button, another class is instantiated, then calls the method to process
files. On the form I've added a toolStripProgressBar, so the user can view
the progress of the update. What I wish to do is to raise 2 events. One to
set the ToolstripProgressBar minimum, maximum, and Step properties. I think
the 2nd event would be to PerformStep method when a file has been processed.
But I'm not sure how to go about doing this. I'm not sure where to declare
the events, delegates, ect. Each class is kept in its own class file, but
are under the same namespace. Here is a sample of code:
public partial class FileProcessor : Form
{
private void btnProcess_Click(object sender, EventArgs e)
{
string message = null;
if (listBox1.SelectedItems.Count == 0)
{
MessageBox.Show("You must select a vendor.", "Vendor
Required!",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
else
{
PaperVendor pv = new PaperVendor()
pv.ProcessFiles();
}
}
}
public class PaperVendor
{
public void ProcessFiles()
{
try
{
DirectoryInfo di = new DirectoryInfo(path)
FileInfo files = di.GetFiles("*.txt")
foreach (FileInfo fiTemp in files)
{
// raise event to set toolStripStatusBar properties???
// do my processing
// raise OnStep event here, but how??
}
......