show data source information using MSD axapta

show data source information using axapta

 FormDatasource formDatasource;  
 FormGroupControl formGroupControl;  
 FormStaticTextControl formStaticTextControl;  
 Counter counter;  
 Counter noOfDatasources;  
 ;  
 noOfDatasources = this.form().dataSourceCount();  
 if (noOfDatasources)  
 {  
 formGroupControl = this.form().design().addControl(FormControlType::Group,  
 "formGroupControl");  
 formGroupControl.caption("Tables used by form");  
 formGroupControl.frameType(3);  
 }  
 for (counter=1; counter <= noOfDatasources; counter++)  
 {  
 formStaticTextControl = formGroupControl.addControl(FormControlType::StaticText,  
 "formStaticTextControl" + int2str(counter));  
 formStaticTextControl.text(tableid2name(this.form().dataSource(counter).table()));  
 }