Capitalize the first letter of a word (TEdit)  

Send By: Q3 Team
Web : http://www.q3.nu
Email: dlib@q3.nu
Date: 21/12/99

Tip accessed 683 times

 


Put this code into OnKeyPress event of the TEdit:


   procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
   begin
      with Sender as TEdit do
         if (Text = '')
         or (Text[SelStart] = ' ')
         or (SelLength = Length(Text)) then
            if Key in ['a'..'z'] then  Key := UpCase(Key);
   end;