For some reason one of my favorite
.NET Framework Class is the
ErrorProvider class. This class allows you to visually indicate to the user that there is an error with one of the form controls. For example, if you have a user input form that allows the user to input information into a TextBox and the user tries to proceed without filling in the TextBox you can set the
ErrorProvider to display an error icon, with an error hint, adjacent to the TextBox. The option of setting the
BlinkStyle and
BlinkRate is also neat.
A real simple example:
procedure TWinForm.Button1_Click(sender: System.Object; e: System.EventArgs);
begin
if TextBox1.text = '' then
ErrorProvider1.SetError(TextBox1,'Invalid Text Entered.')
else
ErrorProvider1.SetError(TextBox1,'');
end;


It is pretty basic and simple to use, but for some reason I am fascinated by it.
Labels: .NET, Code, Delphi