Error while adding checkbox_CheckedChanged Event

I am trying to add event on checkbox changed but keep on getting this error below
‘Script’ does not contain a definition for ‘chkComplete’ and no extension method ‘chkComplete’ accepting a first argument of type ‘Script’ could be found (are you missing a using directive or an assembly reference?)

What I am doing wrong? This is my initialization code:

Blockquote
public void InitializeCustomCode()
{
// Begin Wizard Added Custom Method Calls
this.chkComplete.Click += new System.EventHandler(this.chkComplete_Click);
this.chkComplete.CheckedValueChanged += new System.EventHandler(this.chkComplete_CheckedValueChanged);
this.chkComplete.CheckedChanged += new System.EventHandler(this.chkComplete_CheckedChanged);
// End Wizard Added Custom Method Calls
}

And below is my checkbox changed event:

Blockquote
private void chkComplete_CheckedChanged(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
if (this.chkComplete.Checked == true)
{
MessageBox.Show(“true”);
}
else
{
MessageBox.Show(“false”);
}
}

1 Like