Hello,
I am new to c# and have come accross a problem that I just can't get to work right.
Basically I have a form with a text box I want to use a log of events. I click on a button on the form to run certain tasks, basically this calls a static function in another class. Work is done in that function, but this also calls a void (sub) in the same class. I want to upate the text box on the form with info that is being processed in my void. So, I want it to update the text box live, not all after the fact.
Here is a basic example of what I am doing...
Here Is My Form...
namespace
ResponseTester
{
public partial class frmMain : Form
{
public frmMain()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string
ok = clsDAL.DoSomething();
}
{
}
}
}
Here Is My Other Class..
namespace
ResponseTester
{
class clsDAL
{
public static string DoSomething()
{
//do some work
UpdateForm();
return "OK";
}
public static void UpdateForm()
{
string[] files = Directory.GetFiles(@"C:\");
foreach (string i in files)
{
//I want to print each file to the text log on the main page
}
}
}
}
I played with delegates and other threads for a while and just couldn't get this to work correctly. Thanks in advace to any help anyone can give me.
thanks,
Chad