Dialog and get value from dialog box using Axapta

Below is a Code how  to add dialog and get value from dialog box in dynamics Axapta. This is very simple you just need to create one method which is overridden method is dialog. Dialog method used to initialized dialog box for your form or report but without using get from dialog method you can not get value of dialog control.

So both method is important dialog and getfromdialog.

 public Object dialog(Object _dialog)  
 {  
 DialogRunbase dialog = _dialog;  
 DialogGroup dateGroup;  
 ;  
 dateGroup = dialog.addGroup("");  
 dateGroup.frameType(1);  
 dateGroup.columns(2);  
 fromdate = LedgerPeriod::findOpeningDate(systemdateget());  
 toDate= systemdateget();  
 dialog.addGroup("@SYS4083",dateGroup);  
 dialogFromDate = dialog.addFieldValue(typeid(FromDate),fromDate,'',"@SYS67");  
 dialog.addGroup("@SYS8828",dateGroup) ;  
 dialogToDate = dialog.addFieldValue(typeid(ToDate),toDate,'',"@SYS67");  
 dialog.addGroup("@SYS24500");  
 dialogPageChange = dialog.addFieldValue(typeid(NoYes),pageChange,"@SYS15349","@SYS24755");  
 dialogResetPage = dialog.addFieldValue(typeid(NoYes),resetPage,"@SYS9358","@SYS24756");  
 dialog.addGroup("@SYS12608");  
 dialogDetailSummary = dialog.addFieldValue(typeid(DetailSummary),detailSummary,'',"@SYS24757");  
 dialogNoneBeginTransEnd = dialog.addFieldValue(typeid(NoneBeginTransEnd),noneBeginTransEnd,  
 "@SYS1046","@SYS69638");  
 dialogIncludeOpening = dialog.addFieldValue(typeid(NoYes),includeOpening,"@SYS23250","@SYS54008");  
 dialogIncludeClosing = dialog.addFieldValue(typeid(NoYes),includeClosing,"@SYS14844","@SYS82258");  
 dialog.addGroup("Opening Balance Account");  
 dialogOpeningBalance = dialog.addField(typeId(LedgerAccount)  
 ,"Opening Balance Account");  
 return dialog;  
 }  
 public boolean getFromDialog()  
 {  
 ;  
 fromDate = dialogFromDate.value();  
 toDate = dialogToDate.value();  
 detailSummary = dialogDetailSummary.value();  
 pageChange = dialogPageChange.value();  
 resetPage = dialogResetPage.value();  
 noneBeginTransEnd = dialogNoneBeginTransEnd.value();  
 includeOpening = dialogIncludeOpening.value();  
 includeClosing = dialogIncludeClosing.value();  
 OpLedgerAccount = dialogOpeningBalance.value();  
 return true;  
 }