whats new ¦  programming tips ¦  indy articles ¦  intraweb articles ¦  informations ¦  links ¦  interviews
 misc ¦  tutorials ¦  Add&Win Game

Tips (1547)

Database (90)
Files (137)
Forms (107)
Graphic (115)
IDE (21)
Indy (5)
Internet / LAN (131)
IntraWeb (0)
Math (76)
Misc (127)
Multimedia (45)
Objects/
ActiveX (51)

OpenTools API (3)
Printing (35)
Strings (83)
System (268)
VCL (243)

Top15

Tips sort by
component


Search Tip

Add new Tip

Add&Win Game

Advertising

47 Visitors Online


 
...convert letters of an Editbox to uppercase?
Autor: Thomas Stutz
[ Print tip ]  

Tip Rating (6):  
     


{
  Converts the first letter of an EditBox to UpperCase:

  Wandelte jeweils das erste Zeichen in einer Editbox in
  einen Grossbuchstaben um.
}

procedure TForm1.Edit1Change(Sender: TObject);
var
  
OldStart: Integer;
begin
  with 
Edit1 do
    if 
Text <> '' then
    begin
      
OnChange  := nil;
      OldStart  := SelStart;
      Selstart  := 0;
      Sellength := 1;
      Seltext   := AnsiUpperCase(Text[1]);
      SelStart  := OldStart;
      OnChange  := Edit1Change;
    end;
end;


{
 To convert the fist three letters to uppercase you could write:
 Um die ersten drei Zeichen jeweils in Grossbuchstaben anzuzeigen:
}

 
Selstart := 0;
 SelLength := 3;
 SelText := AnsiUpperCase(Copy(Text, 1, 3));


 

Rate this tip:

poor
very good


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners