Genius John Simmons,
You have no idea how much time you just saved me. Here's the code all put together.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
Form1.cs
namespace PassData
{
public partial class Form1 : Form
{
private readonly Class1 cls = new Class1();
public Form1()
{
InitializeComponent();
cls.ClassDoneEvent += new PassData.Class1.ClassDoneEventHandler(class1_ClassDoneEvent);
}
private void class1_ClassDoneEvent(PassData.Class1.ClassDoneEventArgs e)
{
label1.Invoke(new UpdateLabelTextDelegate(UpdateLabelText), e.Value.ToString());
}
private delegate void UpdateLabelTextDelegate(string text);
private void UpdateLabelText(string text)
{
label1.Text = text;
}
private void btnClose_Click(object sender, EventArgs e)
{
Close();
}
private void btnClass_Click(object sender, EventArgs e)
{
Thread clsThread = new Thread(StartClass1);
clsThread.Start();
}
private void StartClass1()
{
cls.BeginClass();
}
}
}
Class1.cs
namespace PassData
{
class Class1
{
public void BeginClass()
{
ClassDone();
}
public event ClassDoneEventHandler ClassDoneEvent;
private void ClassDone()
{
ClassDoneEvent(new ClassDoneEventArgs());
}
public delegate void ClassDoneEventHandler(ClassDoneEventArgs e);
public class ClassDoneEventArgs : EventArgs
{
public string Value
{
get
{
return "SomeValue";
}
}
}
}
}
apaka, appreciate the response as well, going to have to look into that.