MES Form_Load() only triggers once per session

I have a customization on the End Activity screen in MES that has a Form_Load method to select a certain textbox, to streamline our barcoding. The method works fine but it only triggers the first time that screen is opened per MES session. The next time someone goes to end an activity Form_Load() does not run. I believe this is because it is being stored in cached memory or something similar and is not actually “loading” when it is opened.

Is there another event I could trigger off of that would allow me to do the same thing? Or can Form_Load() be modified to run every time?

Use the initialize custom code method.

Ahh that makes sense.
I tried it a couple ways but neither of them selected what I needed to.
First I made a public void called SelectBox and called it under //End Wizard Added Custom Method Calls but nothing happened.
I also tried just adding the code underneath there instead of putting it into a method.
qty = (EpiNumericEditor)csm.GetNativeControlReference(“f1fdcf24-066d-424e-9b59-319a804854fa”);
qty.Select();
Do I need to add a reference in DestroyCustomCode in order for it to work?

What do you mean add a reference to DesotryCustomCode? That should already be there

well for example when you add a Form event it adds something like
this.markComplete.Click += new System.EventHandler(this.markComplete_Click); into InitializeCustomCode
and
this.markComplete.Click -= new System.EventHandler(this.markComplete_Click); into DestroyCustomCode

Have you tried just setting the Tab Index to 0 on that field? (or 1 can’t remember if is 0 indexed)

I don’t quite understand how Epicor handles tab index. I have that field set to an index of 1 but it instead focuses on the OK button at the bottom of the screen which has a tab index of 3.

Set it to 0? and make sure ther are no conflicting indexes elsewhere (another 1 or another 0)

I tried that and it still does not select it. I can’t tell what it is highlighting instead but it’s not the OK button anymore.

I ended up adding a timer that started in InitializeCustomCode with an eventhandler for my SelectBox method. I think the Initialize custom code was happening too quickly to select it so I added a half second delay.