Creating An On-The-Fly Pop-up Form

by | Epicor

From time to time, I’ve needed to have a pop-up form appear on an Epicor form to ask the user to take some action or enter information. Since the toolbox does not have “EpiForm” as a choice, the form and its controls have to be programmed. This is not a big deal, though you do have to take the time to get the controls all laid out the way you want.

Of course, programming entails changing the code, running it, seeing where things are, changing the code to fix, repeat. I have some formulas I use to help speed up the process, but I still typically need to do some fine-tuning by hand. Also, keep in mind: If you need to create events associated with the controls, you’ll have to code them manually.

Another option is to use Visual Studio to build the form, adjust the items where you want them, and then take the associated form.cs file and copy the code into your program.

Since you don’t always have Visual Studio, an alternate approach came to me. When adding an EpiCombo box to a grid column, I add an EpiCombo to my screen somewhere, adjust the properties so that it gets the list of values I want using the BO. Then I hide it before associating with the grid column.

How To Create Your Epicor Pop-up Form

It occurred to me I should be able to do a similar thing with controls for my pop-up. So, when I need a pop-up form, I do the following:

  1. Add a sheet to the screen using the Sheet Wizard 
  2. Next, add a groupbox to this sheet that is the same size as the pop-up form you will be using
  3. After that, add the controls that you need to the group box, locating them where you need them. Since the group box is the same size as your form, the location information will be the same.
  4. Change any properties on the control, such as EpiBinding, if appropriate 
  5. In the Initialize code section, make the sheet invisible 
  6. Create your pop-up form as usual, except you just need to add the controls you created above, no need to set their location or size, etc.

myPopupForm= new EpiForm();

myPopupForm.Size = new System.Drawing.Size(700, 500);

myPopupForm.StartPosition = FormStartPosition.CenterScreen;

myPopupForm.Controls.AddRange(new Control[] {grdEchoOrders, 

btnOK,

btnCancel,

txtProgress);

myPopupForm.ShowDialog();……

If needed, you can use the event wizard to add events for any of these controls; there is no need to code them manually. The controls are also global, so you can reference them anywhere in the code.

About Encompass Solutions

Encompass Solutions is a business and software consulting firm that specializes in ERP systems, EDI, and Managed Services support for Manufacturers and Distributors. Serving small and medium-sized businesses since 2001, Encompass modernizes operations and automates processes for hundreds of customers across the globe. Whether undertaking full-scale implementation, integration, and renovation of existing systems, Encompass provides a specialized approach to every client’s needs. By identifying customer requirements and addressing them with the right solutions, we ensure our clients are equipped to match the pace of Industry.