Customization VB Code GetNativeControlReference Method

Can you send me or post a screen shot of the properties screen for the check box that you are trying to access? Make sure the the epiGUid is visible.

jimki@...

--- In vantage@yahoogroups.com, "k99ja04" <jallmond@...> wrote:
>
> Here is my complete code.
>
> '//**************************************************
> '// Custom VB.NET code for ReportForm
> '// Created: 2/18/2010 10:33:34 AM
> '//**************************************************
> Imports System
> Imports System.Data
> Imports System.Diagnostics
> Imports System.Windows.Forms
> Imports System.ComponentModel
> Imports Microsoft.VisualBasic
> Imports Epicor.Mfg.UI
> Imports Epicor.Mfg.UI.FrameWork
> Imports Epicor.Mfg.UI.ExtendedProps
> Imports Epicor.Mfg.UI.FormFunctions
> Imports Epicor.Mfg.UI.Customization
> Imports Epicor.Mfg.UI.Adapters
> Imports Epicor.Mfg.UI.Searches
>
> Module 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 WithEvents ctrl as EpiCheckBox
>
>
> Sub InitializeCustomCode()
> ctrl = CType(csm.GetNativeControlReference("ca5ec522-471d-40c0-a5a1-a54b62d4f41d-1"), EpiCheckBox)
>
> '// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Intialization' lines **
> '// Begin Wizard Added Variable Intialization
>
> '// End Wizard Added Variable Intialization
> '// Begin Custom Method Calls
>
> '// End Custom Method Calls
> End Sub
>
> Sub DestroyCustomCode()
> ctrl = Nothing
>
> '// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
> '// Begin Wizard Added Object Disposal
>
> '// End Wizard Added Object Disposal
> '// Begin Custom Code Disposal
>
> '// End Custom Code Disposal
> End Sub
>
> Private Sub ReportForm_Load(ByVal sender As object, ByVal args As EventArgs) Handles ReportForm.Load
> '//
> '// Add Event Handler Code
> '//
> ctrl.Checked = True
> End Sub
> End Module
>
Some background: I created a customization to use the Customer.Number01 field to what we are calling "Insured Amount," And deployed it to Financial > AR > Setup > Customer progam. All is well. I wand to add it th the AR Aging Report, so I duplicated the ARAgng report definition and modified it to add the Customer table and added a relationship to bind field ARPrnt.ParentCustID to Customer.CustID. So far so good. I next tweaked the AgdRcv.rpt Crystal Report to add Customer.Numer01 and Customer.CreditLimit to the Summary view. Success, my fields show up!

The trick is that report is already very "busy", and it's tough to sneak in 2 extra fields without moving the canned stuff around. I suppressed my fields when not requesting Summary Only, but bottom line I had to move stuff around and basically broke the full detail AR report view.

My next line of thinking was to duplicate that report and have one menu item for the canned "AR Aging Report" and one for "AR Aging Report (Summary)". I then ran into a wall because while I can duplicate the menu item, and duplicate the Report Style to specify an alternate Crystal .rpt file, I can't link each menu item to a specific report style (or can I? possibly through a customization, maybe VB code needed?), I can only specify the program as Epicor.Mfg.UIRpt.ARAgedRecReport.dll and any customizations. Is it possible to use a customization to link to a specific report style? Is this an Epicor Vantage SDK thing?

Ok so in that same thought of duplicate menu items, I wanted to have one menu automatically default the Summary Only checkbox to true. Only after round 1 of experimenting did I discover the Actions > Save Defaults. But if I use this approach, I think the defaults would persist through both menu items, which is not gonna fit the bill here.

I then had the thought to force the checkbox to checked through a customization. I was able to write some VB code, but I get an error, "Control with specified EpiGuid property does not exist," when I try to launch the deployed customization. I copied the EpiGUID directly from the Summary Only checkbox control. To test my approach I created my own checkbox and copied the EpiGUID of my checkbox and it works fine. Is it possible to "touch" the pre-made controls or does one need the Epicor SDK?

Below is my VB code.

Sub InitializeCustomCode()
Dim ctrl as EpiCheckbox = CType(csm.GetNativeControlReference("15fa13f3-a431-42a6-96b0-a4a21b9861ef"), EpiCheckbox)
ctrl.Checked = True
End Sub

Weird how I can default check my own checkbox, but can't "touch" the pre-existing ones. Again, is this an SDK required thing?

I think ultimately I will have to write my own BAQ report, and leave the stock AR Aging report untouched. Sorry, I know this got long, but thoughts?
Thanks,
Jared
_______________________
Jared Allmond
IT Systems Engineer
Wright Coating Technologies
jallmond@...
voice: 269.344.8195
direct: 269.341.4353
fax: 269.344.3007
What version of Vantage are you on? Knowing the verison I might be able to verify the epiGuid. What you are trying to do should work, I work with existing controls all the time. Normally I declare the object as a global so I can access it anywhere. Then make the assignment in the initialize code.

Private WithEvents txtMaterial As EpiTextBox


....

txtMaterial = CType(csm.GetNativeControlReference("98713b17-dbee-4637-bde3-ca84746d5bae"), EpiTextBox)

En>compass Solutions Inc.
Tel 336.298.1296 (Google Voice)
Fax 336.217.7983
E-mail jimki@...
www.encompass-inc.com

--- In vantage@yahoogroups.com, "k99ja04" <jallmond@...> wrote:
>
> Some background: I created a customization to use the Customer.Number01 field to what we are calling "Insured Amount," And deployed it to Financial > AR > Setup > Customer progam. All is well. I wand to add it th the AR Aging Report, so I duplicated the ARAgng report definition and modified it to add the Customer table and added a relationship to bind field ARPrnt.ParentCustID to Customer.CustID. So far so good. I next tweaked the AgdRcv.rpt Crystal Report to add Customer.Numer01 and Customer.CreditLimit to the Summary view. Success, my fields show up!
>
> The trick is that report is already very "busy", and it's tough to sneak in 2 extra fields without moving the canned stuff around. I suppressed my fields when not requesting Summary Only, but bottom line I had to move stuff around and basically broke the full detail AR report view.
>
> My next line of thinking was to duplicate that report and have one menu item for the canned "AR Aging Report" and one for "AR Aging Report (Summary)". I then ran into a wall because while I can duplicate the menu item, and duplicate the Report Style to specify an alternate Crystal .rpt file, I can't link each menu item to a specific report style (or can I? possibly through a customization, maybe VB code needed?), I can only specify the program as Epicor.Mfg.UIRpt.ARAgedRecReport.dll and any customizations. Is it possible to use a customization to link to a specific report style? Is this an Epicor Vantage SDK thing?
>
> Ok so in that same thought of duplicate menu items, I wanted to have one menu automatically default the Summary Only checkbox to true. Only after round 1 of experimenting did I discover the Actions > Save Defaults. But if I use this approach, I think the defaults would persist through both menu items, which is not gonna fit the bill here.
>
> I then had the thought to force the checkbox to checked through a customization. I was able to write some VB code, but I get an error, "Control with specified EpiGuid property does not exist," when I try to launch the deployed customization. I copied the EpiGUID directly from the Summary Only checkbox control. To test my approach I created my own checkbox and copied the EpiGUID of my checkbox and it works fine. Is it possible to "touch" the pre-made controls or does one need the Epicor SDK?
>
> Below is my VB code.
>
> Sub InitializeCustomCode()
> Dim ctrl as EpiCheckbox = CType(csm.GetNativeControlReference("15fa13f3-a431-42a6-96b0-a4a21b9861ef"), EpiCheckbox)
> ctrl.Checked = True
> End Sub
>
> Weird how I can default check my own checkbox, but can't "touch" the pre-existing ones. Again, is this an SDK required thing?
>
> I think ultimately I will have to write my own BAQ report, and leave the stock AR Aging report untouched. Sorry, I know this got long, but thoughts?
> Thanks,
> Jared
> _______________________
> Jared Allmond
> IT Systems Engineer
> Wright Coating Technologies
> jallmond@...
> voice: 269.344.8195
> direct: 269.341.4353
> fax: 269.344.3007
>
Using an Epicor 9 environment so the EpiGuid may be different but this code sets the summary check box to true. Notice that the assignment takes place in the form load event not the initialize
....
'//**************************************************
'// Custom VB.NET code for ReportForm
'// Created: 2/18/2010 9:11:41 AM
'//**************************************************
Imports System
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports Microsoft.VisualBasic
Imports Epicor.Mfg.UI
Imports Epicor.Mfg.UI.FrameWork
Imports Epicor.Mfg.UI.ExtendedProps
Imports Epicor.Mfg.UI.FormFunctions
Imports Epicor.Mfg.UI.Customization
Imports Epicor.Mfg.UI.Adapters
Imports Epicor.Mfg.UI.Searches
Imports Epicor.Mfg.BO


Module 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 WithEvents ctrl As EpiCheckBox



Sub 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

'// End Wizard Added Custom Method Calls
ctrl = CType(csm.GetNativeControlReference("ca5ec522-471d-40c0-a5a1-a54b62d4f41d"), EpiCheckBox)

'// this attempts to set it too early, no error just doesn't have any effect
'// ctrl.Checked = true

End Sub



Sub DestroyCustomCode()


'// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
'// Begin Wizard Added Object Disposal

'// End Wizard Added Object Disposal
'// Begin Custom Code Disposal

'// End Custom Code Disposal

End Sub

Private Sub ReportForm_Load(ByVal sender As Object, ByVal args As EventArgs)
'Add Event Handler Code
'// this sticks
ctrl.Checked = true
End Sub


End Module


--- In vantage@yahoogroups.com, "k99ja04" <jallmond@...> wrote:
>
> Some background: I created a customization to use the Customer.Number01 field to what we are calling "Insured Amount," And deployed it to Financial > AR > Setup > Customer progam. All is well. I wand to add it th the AR Aging Report, so I duplicated the ARAgng report definition and modified it to add the Customer table and added a relationship to bind field ARPrnt.ParentCustID to Customer.CustID. So far so good. I next tweaked the AgdRcv.rpt Crystal Report to add Customer.Numer01 and Customer.CreditLimit to the Summary view. Success, my fields show up!
>
> The trick is that report is already very "busy", and it's tough to sneak in 2 extra fields without moving the canned stuff around. I suppressed my fields when not requesting Summary Only, but bottom line I had to move stuff around and basically broke the full detail AR report view.
>
> My next line of thinking was to duplicate that report and have one menu item for the canned "AR Aging Report" and one for "AR Aging Report (Summary)". I then ran into a wall because while I can duplicate the menu item, and duplicate the Report Style to specify an alternate Crystal .rpt file, I can't link each menu item to a specific report style (or can I? possibly through a customization, maybe VB code needed?), I can only specify the program as Epicor.Mfg.UIRpt.ARAgedRecReport.dll and any customizations. Is it possible to use a customization to link to a specific report style? Is this an Epicor Vantage SDK thing?
>
> Ok so in that same thought of duplicate menu items, I wanted to have one menu automatically default the Summary Only checkbox to true. Only after round 1 of experimenting did I discover the Actions > Save Defaults. But if I use this approach, I think the defaults would persist through both menu items, which is not gonna fit the bill here.
>
> I then had the thought to force the checkbox to checked through a customization. I was able to write some VB code, but I get an error, "Control with specified EpiGuid property does not exist," when I try to launch the deployed customization. I copied the EpiGUID directly from the Summary Only checkbox control. To test my approach I created my own checkbox and copied the EpiGUID of my checkbox and it works fine. Is it possible to "touch" the pre-made controls or does one need the Epicor SDK?
>
> Below is my VB code.
>
> Sub InitializeCustomCode()
> Dim ctrl as EpiCheckbox = CType(csm.GetNativeControlReference("15fa13f3-a431-42a6-96b0-a4a21b9861ef"), EpiCheckbox)
> ctrl.Checked = True
> End Sub
>
> Weird how I can default check my own checkbox, but can't "touch" the pre-existing ones. Again, is this an SDK required thing?
>
> I think ultimately I will have to write my own BAQ report, and leave the stock AR Aging report untouched. Sorry, I know this got long, but thoughts?
> Thanks,
> Jared
> _______________________
> Jared Allmond
> IT Systems Engineer
> Wright Coating Technologies
> jallmond@...
> voice: 269.344.8195
> direct: 269.341.4353
> fax: 269.344.3007
>
Version 803.408B (SQL). I get same error when I declare global. I think the GUID I posted originally was from my generated checkbox, but the EpiGUID I have for chkReleased checkbox is ca5ec522-471d-40c0-a5a1-a54b62d4f41d-1. Under Financial > AR > Reports > Aged Receivables.
Thanks,
Jared

--- In vantage@yahoogroups.com, "jckinneman" <jckinneman@...> wrote:
>
>
>
> What version of Vantage are you on? Knowing the verison I might be able to verify the epiGuid. What you are trying to do should work, I work with existing controls all the time. Normally I declare the object as a global so I can access it anywhere. Then make the assignment in the initialize code.
Here is my complete code.

'//**************************************************
'// Custom VB.NET code for ReportForm
'// Created: 2/18/2010 10:33:34 AM
'//**************************************************
Imports System
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports Microsoft.VisualBasic
Imports Epicor.Mfg.UI
Imports Epicor.Mfg.UI.FrameWork
Imports Epicor.Mfg.UI.ExtendedProps
Imports Epicor.Mfg.UI.FormFunctions
Imports Epicor.Mfg.UI.Customization
Imports Epicor.Mfg.UI.Adapters
Imports Epicor.Mfg.UI.Searches

Module 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 WithEvents ctrl as EpiCheckBox


Sub InitializeCustomCode()
ctrl = CType(csm.GetNativeControlReference("ca5ec522-471d-40c0-a5a1-a54b62d4f41d-1"), EpiCheckBox)

'// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Intialization' lines **
'// Begin Wizard Added Variable Intialization

'// End Wizard Added Variable Intialization
'// Begin Custom Method Calls

'// End Custom Method Calls
End Sub

Sub DestroyCustomCode()
ctrl = Nothing

'// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
'// Begin Wizard Added Object Disposal

'// End Wizard Added Object Disposal
'// Begin Custom Code Disposal

'// End Custom Code Disposal
End Sub

Private Sub ReportForm_Load(ByVal sender As object, ByVal args As EventArgs) Handles ReportForm.Load
'//
'// Add Event Handler Code
'//
ctrl.Checked = True
End Sub
End Module
I tried moving things around as your code suggests, still no go. Here is the error detail.

Error Detail
============
Exception has been thrown by the target of an invocation.


Stack Trace
===========
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Epicor.Mfg.UI.Customization.CustomScriptManager.initCustomAssembly(Assembly assm)

Inner Exception
===============
Control with specified EpiGuid property does not exist.

csm.GetNativeControlReference("ca5ec522-471d-40c0-a5a1-a54b62d4f41d-1")

Inner Stack Trace
=================
at Epicor.Mfg.UI.Customization.CustomScriptManager.GetNativeControlReference(String epiGuid)
at Script.InitializeCustomCode()