473,386 Members | 1,943 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Help with rasing an event

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??
}
......
Jun 6 '06 #1
0 1216

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title>...
2
by: MC D | last post by:
I have an event that I am defining in one class, and I want to subscribe to it in another. I have the delegate for the event in the top of my class: public delegate void...
4
by: Jeff User | last post by:
Hi I tryed to solve this problem over in the framework.asp group, but still am having trouble. Hope someone here can help. using .net 1.1, VS 2003 and C# I have an asp.DataGrid control with a...
53
by: Hexman | last post by:
Hello All, I'd like your comments on the code below. The sub does exactly what I want it to do but I don't feel that it is solid as all. It seems like I'm using some VB6 code, .Net2003 code,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.