Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How does one force UpperCase in just one Grid Column? 1

Status
Not open for further replies.

delphiman

Programmer
Dec 13, 2001
422
ZA

An EditBox (TDBEdit) has a CharCase Property which one can set to ecUpper, ecLower or ecNormal.

How can one set the CharCase for a particular colum in a Grid to be ecUpper?

Alternatively how can one force (say) MyRecordMyField.value into being in UpperCase?

Thanks in advance.
 
Suppose you want the user to only be able to enter upper case letters in the second column of your grid then write an OnKeyPress event handler for the DBGrid something like
Code:
procedure TForm1.DBGrid1KeyPress(Sender: TObject; var Key: Char);
begin
  if DBGrid1.SelectedIndex = 1 then
    key := UpCase(key);
end;
The SelectedIndex property of the grid indicates which column currently has focus. The first column has a SelectedIndex of 0.

Andrew
Hampshire, UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top