Form Designing And Executing In Microsoft Dynamics NAV(Navision) Using C/AL
By this topic i will tell how to design a Microsoft Dynamics NAV Form Designing and Excetions of a simple program.
There are mainly 5 steps we have to care when we design a Simple Form without using table in the Dynamics NAV.
- Designing Form
- Defining Variables
- Assigning Variables to the designed form objects
- Create a programe code to excute the form
- Run the form
- Designing Form:- For design a form you have to first goto the Tools -> Object Designer -> Form. Then click on the New Button. Select create a blank form and press ok. After opening that select from the menu View -> Toll Boox, View ->Font , View -> Color. Tool Box is the area where containing all the tools need to be included in the form like Label, Button, Text Box. Font is the area where we can manage all the font related activites of the text. First click on the Add Label option in the Tool Box. Color is the area where we can assign colors to different objects. After selecting these boxes you have to goto the Tool Box and select the Tool Frame and place them in the form, next click Add Label, then click text box notice that both the label and text boxes created at a strech. You have to place 3 text boxes in the form and one Command Button from the Tool Box. Our aim is to add the value of two items and display the value in the thrird one named Result.
- Defining Variables:- For doing the abow problem we have to define 3 variables named Value1,Value2 and Result. For doing this goto the View C/AL Globals section and enter the 3 variables as Decimal Data types. ie, Value1 - Decimal, Value2 - Decimal, Result- Decimal.For defining these refer http://mibutech.blogspot.com/2010/02/sample-program-to-display-stored-data.html link.
- Assigning Variables to the designed form objects:- For asigning values to the object is the main area where we are connecting our designed objects to the variables we are defined. For doing this we have to select each and every text box one by one and then Goto the View -> Properties option, there look the SourceExpr and then drill down the options in the right side and select one by one variables and asign. ie, click on the first text box and then asign the Value1, select second text box and asign the Sourceexpr as Value2 and in the Third one asign Result. After doing this you will see following type screen.
- Create a programe code to excute the form:- For calulate something using the objects input data we have to define the programming code. A sample program for calculate the addition of Value1 and Value2 and display the value in the Result is as follows. ----------------------------------------------------------------------------------------- Result := Value1 + Value2; ----------------------------------------------------------------------------------------- You have to place this in the Form OnRun(). For doing this click design buttor in the Object desginer-> Form. Goto the OnRun() and type folowing code there.
- Run the form:- For run the form you have to open the Object designer then press the Run Button. Then the following picture like result you will get.