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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mask in Stringgrid 1

Status
Not open for further replies.

EricDraven

Programmer
Jan 17, 2002
2,999
GB
Does anybody know if it is possible to make a column in a stringgrid contain a simple mask. I have a grid containing a few fields and the last one will always be a date field as follows.

TITLE FORNAMES SURNAME DOB
Mr Fred Bloggs 01/01/1956
Mrs Freda Bloggs 02/02/1962

I need to ensure that the users enter the date as shown here because of calculations and printouts used later on in the program. Arte Et Labore
 
Arte,

Is this from a table? If so, then it's actually easier to set the EditMask property of the underlying TField object instead.

Hope this helps...

-- Lance
 
No its not from a table, its going to be saved to a table later on. The grid basically sits on a form where the user needs to be able to enter anything upto twelve names and dates of birth. Due to the number of components on the form, design space is limited and usually the maximum number of users entered would only be about four or five. Using the grid allows me to give the user the option of adding the others quite easily, I just cant get a mask to work in the last column of the grid to proompt the user on how to enter the date. Arte Et Labore
 
Arte,

Try adding something like this to the StringGrid's OnGetEditMask event:

Code:
   with Sender as tStringGrid do
      if ACol = ColCount - 1 then
         Value := '!99/99/0099;1;_';

You might need to play with the actual mask a bit, but this should get you started.

Hope this helps...

-- Lance
 
Many thanks Footpad, that seems to work pretty much how I wanted it to, so have a star! Arte Et Labore
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top