Linking add-ins with the database
The current recipe will cover the topic of creating a custom textbox control bound to a database field. Such control can be linked with a table field via the standard NAV property, SourceExpr
. Any changes made by the user in a control linked to a table field are automatically reflected in the database.
How to do it...
Run Visual Studio and create a Class Library project. Choose to create a new solution and enter
NavDatabaseFieldControl
as the name of the project.Rename the class
Class1
in the solution explorer. Assign a new name,DatabaseFieldControl
, and accept renaming all code references.In the solution explorer window, add references to assemblies
Microsoft.Dynamics.Framework.UI.Extensibility.dll
andSystem.Windows.Forms
.Remove default using statements and replace them with the following:
       using System;       using Microsoft.Dynamics.Framework.UI.Extensibility;       using Microsoft.Dynamics.Framework.UI.Extensibility.WinForms;       using...