Modifying a Form in GP is often a simple thing to do with few repercussions if planned and executed properly. One drawback to a form modification is that you have to upgrade the modified forms even when applying service packs. This makes the service pack application and upgrade processes slightly more cumbersome. Not a big deal but another step in the process that in some instances you might be able to avoid. Some of my existing clients are starting to request VSTools customizations over VBA partly for this reason.
While this isn't always applicable, you can't modify a GP Form with VSTools after all, you can sometimes leverage the VSTools .AddMenuHandler method in place of modifying a form in GP. You can find more information about the .AddMenuHandler on page 71 of the VSTDGPProgrammersGuide.pdf.
Here's an example of how to use the .AddMenuHandler method instead of modifying a GP Form:
Below is the code to add an Additional Menu Handler that when executed calls a function that will retrieve the next numeric Fixed Asset ID and populate the Asset ID in the Asset General Information Window.
Dim FANextNumericID As System.EventHandler
Sub Initialize() Implements IDexterityAddIn.Initialize
FANextNumericID = New System.EventHandler(AddressOf FAGetNextNumericID)
FixedAssets.Forms.FaGeneralMaintenance.AddMenuHandler(FANextNumericID, "Next Asset ID", "N")
End Sub
Now, in GP you can simply use the Ctrl-N hotkey or select Next Asset ID from the Additional Menu…
2 comments:
Great article! You picked up where I left off (due to many commitments) with the Visual Studio Tools series.
I am starting to favor VST over VBA as well, as the release to production process is much much more simplified than that of VBA. In fact, another issue with VBA is, you can only import package files when ALL users are out of the system, hence having no locks on the forms dictionary. Not good for 100 users.
MG.-
really amazing blog and I was thankful to you for sharing such a useful information.
- CRM Solutions
Post a Comment