Validate Name in MSD Axapta

Validate Name in Axapta

To Validate Name in Axapta  you can refer below code.
--------------------------------------Code block----------------------------
 boolean validatestrName(str strName)  
 {  
   Boolean valid,flag;  
   System.Boolean flagTest;  
   str matchstrNo = "^[a-z, ,A-Z]+$";  
   System.Text.RegularExpressions.Match myMatch;  
   New InterOpPermission(InteropKind::ClrInterop).assert();  
   myMatch =System.Text.RegularExpressions.Regex::Match(strName,matchstrNo);  
   flagTest = myMatch.get_Success();  
   flag = flagTest;  
   CodeAccesspermission::revertAssert();  
   if(strName == "")  
     return true;  
   else  
     return flag;  
 }  
--------------------------------------End Code block-------------------------