Home > Back-end > Consult an edit initials limit input problem
Consult an edit initials limit input problem
Time:09-26
Every BBS A great god, and I designed A scanning system of the input, want to ask, how to limit edit1 can enter the first letter for B, B, and digital, edit2 can only enter A, A, input error an error, then the attached code and interface, function complete for edit1 scanning under to enter signal has to jump to edit2, edit2 scan done to receive the scanning gun enter from the button to complete the entry, and jump edit1, the new one, the hope can get everybody's help thank you
Private {Private declarations} Public {Public declarations} end;
Var Form1: TForm1;
Implementation
USES Unit2.
{$R *. DFM}
Procedure TForm1. Button2Click (Sender: TObject); The begin With adoquery1 do The begin The close; SQL. Text:="insert into saomiao (hougai ziju) values (' ' '+ edit1. Text +' ' ', ' '+ edit2. Text +') '. Execsql; end; end;
Procedure TForm1. N1Click (Sender: TObject); The begin Form2. Show; end;
Procedure TForm1. Edit1KeyPress (Sender: TObject; Var Key: Char); The begin If 13 is the enter key=# 13 then// The begin Edit2. SetFocus; end; end;
Procedure TForm1. Edit2KeyPress (Sender: TObject; Var Key: Char); The begin If the key=# 13 then The begin Button2. Click; Edit1. SetFocus; end; end; End.
CodePudding user response:
Can input error an error prompt
CodePudding user response:
If not in [] then or to change it to judge the character length, if the lengh () length is 1, then the if... else... Bar code machine can set, if after the scan is complete and press enter
CodePudding user response:
Edit1 first character is B or B, followed by the Numbers: A12312412 Or the first character is B or B or digital,