Lainkes 0 Posted February 23, 2023 Hello, I have an inputmask (maskedit component). A part of the mask is the curreny year. So now users need to type the year. Is there a way to put the current year already in the mask? Thanks Lainkes Share this post Link to post
programmerdelphi2k 237 Posted February 23, 2023 (edited) You can use "\" to define non-replaceable characters in your mask. Thus, these characters will appear and will not be replaceable Some like this, or another to "add "\" before each digit of year-value uses DateUtils; procedure TForm1.Button1Click(Sender: TObject); var LYear: string; begin for var D in YearOf(now).ToString do LYear := LYear + '\' + D; // MaskEdit1.Clear; MaskEdit1.EditMask := Format('!99/99/%s;1;_', [LYear]); //'!99/99/' + LYear + ';1;_'; Caption := MaskEdit1.EditMask; end; Edited February 23, 2023 by programmerdelphi2k Share this post Link to post