
I need to hide a form control.
The form in question is the whsloadtable (All Loads) and the field is the Shipping Carrier

To hide it I can use event handlers so I enter the WHSLOADTABLE Form, open the datasource, click on “Events” and right-click on the “OnActivated” event. Then click on “Copy event handler method”

Now create ane mpty class and paste the code you’ve just copied.
Then write code shown below
public class myclass
{
[FormDataSourceEventHandler(formDataSourceStr(WHSLoadTable, WHSLoadTable), FormDataSourceEventType::Activated)]
public static void WHSLoadTable_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
{
FormRun element = sender.formRun();
FormControl carrierCode = element.design().controlName(formControlStr(WHSLoadTable, WHSLoadTable_CarrierCode)); //Put here the name of the Form control. In this example the name is WHSLoadTable_CarrierCode
carrierCode.visible(false);
}
}