In the Property itself you can’t do anything, because the Exception is thrown before the Age-Property is set.The solution is to define a Property special for Display in the Person-class.Abstract: Data Grid View control is a Windows Forms control that gives you the ability to customize and edit tabular data.It gives you number of properties, methods and events to customize its appearance and behavior.
In my case I implement the Property directly in the Person-class. Inside that property you can then throw your own Format Exception with your special text.The following image shows how a Data Validation Input Message after embedded in an Excel cell.If you play around with the Data Grid in Silverlight and try some scenarios, maybe you come around the Format Exception with the Message “Input String is not in a correct format”. has a Property of type int and the user enters some characters in the Data Grid.You can not attach validation controls directly to these Text Boxes.In a Win Form I'm doing initial validation in the Form. To make the code short only three fields are shown in the code.