We are using Epicor customization tools and need some help with passing a variable. We know how to do it in VB but not C# In the example below we are working on the private void epiButtonC1_Click(object sender, System.EventArgs args) event and will copycat to the other button click events once we find a solution. There is a box on the screen where we are trying to get the information from it using the GUID and then pass it to the form we are opening. The MessageBox in there is to check and see if the value shows up but that is not right either as it just shows "MyJob"
// **************************************************// Custom code for MainController// Created: 05/09/2018 2:44:06 PM// **************************************************using System;using System.ComponentModel;using System.Data;using System.Diagnostics;using System.Windows.Forms;using Epicor.Mfg.BO;using Epicor.Mfg.UI;using Epicor.Mfg.UI.Adapters;using Epicor.Mfg.UI.Customization;using Epicor.Mfg.UI.ExtendedProps;using Epicor.Mfg.UI.FormFunctions;using Epicor.Mfg.UI.FrameWork;using Epicor.Mfg.UI.Searches;public class Script{ // ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! ** // Begin Wizard Added Module Level Variables ** // End Wizard Added Module Level Variables ** // Add Custom Module Level Variables Here ** private EpiTextBox MyJob; public void InitializeCustomCode() { // ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines ** // Begin Wizard Added Variable Initialization // End Wizard Added Variable Initialization // Begin Wizard Added Custom Method Calls this.epiButtonC1.Click += new System.EventHandler(this.epiButtonC1_Click); this.epiButtonC2.Click += new System.EventHandler(this.epiButtonC2_Click); this.epiButtonC3.Click += new System.EventHandler(this.epiButtonC3_Click); this.epiButtonC4.Click += new System.EventHandler(this.epiButtonC4_Click); // End Wizard Added Custom Method Calls } public void DestroyCustomCode() { // ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines ** // Begin Wizard Added Object Disposal this.epiButtonC1.Click -= new System.EventHandler(this.epiButtonC1_Click); this.epiButtonC2.Click -= new System.EventHandler(this.epiButtonC2_Click); this.epiButtonC3.Click -= new System.EventHandler(this.epiButtonC3_Click); this.epiButtonC4.Click -= new System.EventHandler(this.epiButtonC4_Click); // End Wizard Added Object Disposal // Begin Custom Code Disposal // End Custom Code Disposal } private void epiButtonC1_Click(object sender, System.EventArgs args) { // ** Place Event Handling Code Here ** MyJob = (EpiTextBox)csm.GetNativeControlReference("a214bbab-19c0-4575-8387-591adb7c0624"); LaunchFormOptions lfo = new LaunchFormOptions(); lfo.ContextValue = MyJob; lfo.IsModal = false; lfo.SuppressFormSearch = true; MessageBox.Show ("MyJob"); ProcessCaller.LaunchForm (oTrans, "IMGO3005", lfo); } private void epiButtonC2_Click(object sender, System.EventArgs args) { // ** Place Event Handling Code Here ** LaunchFormOptions lfo = new LaunchFormOptions(); lfo.ContextValue = "MyJob"; lfo.IsModal = false; lfo.SuppressFormSearch = true; ProcessCaller.LaunchForm (oTrans, "IMGO3001", lfo); } private void epiButtonC3_Click(object sender, System.EventArgs args) { // ** Place Event Handling Code Here ** LaunchFormOptions lfo = new LaunchFormOptions(); lfo.ContextValue = "MyJob"; lfo.IsModal = false; lfo.SuppressFormSearch = true; ProcessCaller.LaunchForm (oTrans, "JCGO3002", lfo); } private void epiButtonC4_Click(object sender, System.EventArgs args) { // ** Place Event Handling Code Here ** LaunchFormOptions lfo = new LaunchFormOptions(); lfo.ContextValue = "MyJob"; lfo.IsModal = false; lfo.SuppressFormSearch = true; ProcessCaller.LaunchForm (oTrans, "IMGO3014", lfo); }}
Where is box on the screen ?
What specifically do you ask?
Trygve Thayer
ASKER
In the Epicor Tools there is a way to put a box on the screen and bind it to a field. That box has a unique Guid. In VB code before we could do a Private WithEvents MyJob as EpiTextbox (My Job is just a variable I made up) then we assign the variable to a textbox MyJob=CType(csm.GetNativeControlReference("b9883534-0081-457e-9c79-abb38b41da22"),EpiTextBox) then when we open a form we reference it as MyJob.text
What specifically do you ask?