Setting a value of a Combo box

Hi
I want to set the default value of a EpiCombo box.
I have set a checkbox field successfully so I thought I was on the right track. I don’t get an error but nothing happens. Also, I only want to do this for one of the companies an I don’t know how to code that either.

The code is:

--------------------------------------------------------------------------------
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 **
	private EpiCheckBox chkAdHoc;
	private EpiCombo cboAllocTemplate;
	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

		// 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

		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal

		// End Custom Code Disposal
	}

	private void AllocationProcessForm_Load(object sender, EventArgs args)
	{
		// Add Event Handler Code
		chkAdHoc = (EpiCheckBox)csm.GetNativeControlReference("df1bcfca-5a58-4e64-afb3-705d80c0186e");
		chkAdHoc.Checked = false;
		cboAllocTemplate = (EpiCombo)csm.GetNativeControlReference("a6c759d5-c577-45d4-8e2f-379945bac1ba");
		cboAllocTemplate.Value = "BEMNZ";
	}
}

I thought I was onto something but this didn’t work either:

1 Like

It would be better to set the data field rather than the control. I don’t have access to my system right now to try anything out, but setting the data field that the control is bound to will be better. Look through the object explorer to review the different objects and their properties. I don’t know what you field is bound to, but what may be going on is that the data is being sent to the control after you are setting it.

Another possibility is to set the extended properties of the control so that the initial value is what you want it to be. I’m not sure exactly how it would work directly in the customization, but if you don’t there, you can make the customization company specific. Check out the customization wizards there to get example code injected into your customization.

Can you please give us an idea how to do this?.