Hi Gunjan,
i solved the problem by the following code:
1- to set focus on the field once the form opened i copy Activited event in form data source and add this code
[FormDataSourceEventHandler(formDataSourceStr(SalesTable, SalesLine), FormDataSourceEventType::Activated)]
public static void SalesLine_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
{
FormRun fr = sender.formRun() as FormRun;
fr.design().controlName(formControlStr(SalesTable,SalesLine_modItemBarCode)).setFocus();
}
2- to set focus on Quantity filed and copy the Modified event for the control and add this code
[FormControlEventHandler(formControlStr(SalesTable, SalesLine_modItemBarCode), FormControlEventType::Modified)]
public static void SalesLine_modItemBarCode_OnModified(FormControl sender, FormControlEventArgs e)
{
FormRun fr = sender.formRun() as FormRun;
fr.design().controlName(FormControlstr(SalesTable,SalesLine_SalesQty)).setFocus();
}