Trying to Disable a Control

I am trying to disable a custom control on the JobMtl screen when the FixedQty checkbox is cleared.
Below is my script and the error I am getting. I am sure it is something simple. Any advise would help

Thanks!

// **************************************************
// Custom code for JobEntryForm
// Created: 6/12/2013 11:59:46 AM
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Epicor.Mfg.BO;
using Epicor.Mfg.UI;
using Epicor.Mfg.UI.Adapters;
using Epicor.Mfg.UI.Customization;
using Epicor.Mfg.UI.ExtendedProps;
using Epicor.Mfg.UI.FormFunctions;
using Epicor.Mfg.UI.FrameWork;
using Epicor.Mfg.UI.Searches;

public class Script
{
	// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
	// Begin Wizard Added Module Level Variables **

	// End Wizard Added Module Level Variables **

	// Add Custom Module Level Variables Here **

	public void InitializeCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization

		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls
		this.chkFixedQty.CheckedChanged += new System.EventHandler(this.chkFixedQty_CheckedChanged);

		// End Wizard Added Custom Method Calls
	}

	public void DestroyCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
		// Begin Wizard Added Object Disposal
		this.chkFixedQty.CheckedChanged -= new System.EventHandler(this.chkFixedQty_CheckedChanged);

		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal

		// End Custom Code Disposal
	}
private void chkFixedQty_CheckedChanged(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
		if (this.chkFixedQty.Checked == true)
		{
			//Make combobox enabled
			epiTextBoxC4.Enabled = true;
		}
		else
		{
			epiTextBoxC4.Enabled = false;
		}
	}
}

image

I would highly recommend you use a RowRule for this.
The chkFixed quantity field can’t be accessed directly, however the dataview will. Just use a row rule.

1 Like

Jose -

Thanks for getting back to me.

Yeah … I switch to the RowRule … I had forgotten about that.
Works perfectly!!