All pastes #73464 Raw Edit

Mine

public text v1 · immutable
#73464 ·published 2006-06-27 21:35 UTC
rendered paste body
public partial class MainForm
{
protected void InitializeComponent()
{

/* CODE */

this.CheckBox.Location = new System.Drawing.Point(5, 20);
this.CheckBox.Name = "SomeCheckBox";
this.CheckBox.Size = new System.Drawing.Size(104, 24);
this.CheckBox.TabIndex = 1;
this.CheckBox.Text = "Some Check Box";
this.CheckBox.UseVisualStyleBackColor = true;
this.CheckBox.CheckedChanged += new System.EventHandler(this.CheckBoxCheckedChanged);
}
}

// Then in another file I have the EventClass class that looks like this:

public class EventClass : MainForm
{
	public void CheckBoxCheckedChanged( object sender, System.EventArgs e )
	{
		/* CODE */		
	}
}


// So, when compiling it doesn't work with the "this" modifier in MainForm, So, I changed
// the code to look like this ( this is the change to my creation in InitializeControls(). )
// It replaces the original delegate.

EventClass EVC = new EventClass();
this.CheckBox.CheckedChanged += new System.EventHandler(EVC.CheckBoxCheckedChanged);


// When I run this now, it gives me some serious exceptions about stack overflow and what
// not. How can I make this work? I don't want all of my code in one single source file.