توی رویداد OnChange اولی این کد رو بنویس:
-----------------------------------------------------
if (Inttostr(TextBox1.Text)>=1) and (Inttostr(TextBox1.Text)<=50) and (Length(TextBox1.Text)=2) then TextBox2.SetFocus;
-----------------------------------------------------
توی رویداد OnExit اولی این کد رو بنویس:
-----------------------------------------------------
if (Inttostr(TextBox1.Text)<1) and (Inttostr(TextBox1.Text)>=50) then ShowMessage('Error');
-----------------------------------------------------
برای تعیین محدوده هم می تونید از MaskEdit استفاده نمایید.