Hello, I hope you are all well and prosperous.
I have a need to have one checkbox show up on a form for a particular company and another checkbox to show up on the form for all other companies. Based on help from the forum on a prior thread, I have this working on the Job Entry form for the Firm checkbox using the following:
private void JobEntryForm_Load(object sender, EventArgs args)
{
// Add Event Handler Code
EpiCheckBox SetFirm_c = (EpiCheckBox)csm.GetNativeControlReference("598ffd4e-7406-4778-bb11-0e3c2a100c6e");
EpiCheckBox chkFirm = (EpiCheckBox)csm.GetNativeControlReference("02844165-290f-418f-b7a9-200f4cb69ee2");
if(oTrans.CoreSession.CompanyID== "FOO")
{
SetFirm_c.Visible = true;
SetFirm_c.ReadOnly = false;
chkFirm.Visible = false;
chkFirm.ReadOnly = true;
}
else
{
SetFirm_c.Visible = false;
SetFirm_c.ReadOnly = true;
chkFirm.Visible = true;
chkFirm.ReadOnly = false;
}
}
}
I’ve given the custom checkbox (SetFirm_c) a red background for the purposes of this thread.
When the form is loaded from the FOO company, the custom checkbox is visible and the standard checkbox is hidden.
When the form is loaded from any other company, the custom checkbox is hidden and the standard checkbox is visible.
It all seems to work as designed. But when I retrieve data into the form, both checkboxes become visible
So why is the form load customization being ignored or over-written upon data load? I can guess that there is another form event that is being triggered that overrides the form Load rules. If that is the case, what form event do I need to apply the same custom logic to keep the intended checkboxes hidden?
Thanks for your input.
Michael