Might it is very simple question but I never touched delphi. I have a edit box and that can accept character. But on some special condition I have to verify the edit box character are only numbers.
How can we do that?
Note: user can enter any char but at the time of validation I have to verify above one.
I don't understand why you would want to allow a user to enter a character, and later not allow it to pass validation.
If you really do need to block entry, then a control that does this for you is better than hacking this up yourself. If your version of delphi is really old, then try out the JVCL: TJvValidateEdit in the JVCL component library, for example, in all versions of delphi. However, in regular recent delphi versions (2009 and later), there is already built in several possible solutions including TMaskEdit and TSpinEdit.
If you really only need to write a validation method, then consider using a regex or hand-coded validation function, and keep that code separate from the control.
// Taking OP question obsessively literally, this
// function doesn't allow negative sign, decimals, or anything
// but digits
function IsValidEntry(s:String):Boolean;
var
n:Integer;
begin
result := true;
for n := 1 to Length(s) do begin
if (s[n] < '0') or (s[n] > '9') then
begin
result := false;
exit;
end;
end;
end;