delphi7里的检验输入文本的代码,里面的#8不知道是什么意思

procedureTForm1.Edit1Change(Sender:TObject);varStr:string;beginStr:='';Str:=Edit1.Tex... procedure TForm1.Edit1Change(Sender: TObject);
var
Str:string;
begin
Str:='';
Str:=Edit1.Text;
if Length(Str)>0 then
if not (Str[Length(Str)] in ['0'..'9',#8]) then
begin
Application.MessageBox('请输入数字!', '明日科技', MB_OKCANCEL + MB_ICONINFORMATION);
Edit1.Text:=LeftStr(Str,Length(Str)-1);
end;
Edit1.SelStart:=Length(Edit1.Text);
end;
#8的作用是什么?
展开
 我来答
e__jin
2011-02-11
知道答主
回答量:73
采纳率:0%
帮助的人:21.4万
展开全部
#8表示 BackSpace键 ,
用在 if not (Str[Length(Str)] in ['0'..'9',#8]) then 这行代码里面 是程序的完善用法。
在Edit 里面输入时 会有BackSpace动作,该语句 允许str的最后一个字符是'0'..'9' 或#8
金山毒霸
2024-10-31 广告
大部分系统错误,是因为某些DLL文件丢失造成的,比如未安装DirectX9或DirectX 9.0组件已损坏、缺少Visual C ++库、未安装.net库。解决方法如下:一、 手动解决方法1、先确定电脑操作系统是多少位的,现在的电脑一般都... 点击进入详情页
本回答由金山毒霸提供
mit1208
2011-02-08 · TA获得超过2347个赞
知道大有可为答主
回答量:2743
采纳率:0%
帮助的人:1833万
展开全部
#8表示 BackSpace键
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
surwe
2011-02-08 · TA获得超过631个赞
知道小有建树答主
回答量:1339
采纳率:44%
帮助的人:242万
展开全部
顺便全部发给你
近日在写程序时,发现对key的值含义又生疏了很多,列举出来以加深记忆:

在onKenDown里边;
key= 13 // 回车键;
key= 9 // Tab键;
如果在OnKenPress中,应该;
Key = #13
Key = #9;

vk_LButton = $01;

vk_RButton = $02;

vk_Cancel = $03;

vk_MButton = $04; { NOT contiguous with L & RBUTTON }

vk_Back = $08; //退格

vk_Tab = $09;

vk_Clear = $0C;

vk_Return = $0D;

vk_Shift = $10;

vk_Control = $11;

vk_Menu = $12;

vk_Pause = $13;

vk_Capital = $14;

vk_Escape = $1B;

vk_Space = $20;

vk_Prior = $21;

vk_Next = $22;

vk_End = $23;

vk_Home = $24;

vk_Left = $25;

vk_Up = $26;

vk_Right = $27;

vk_Down = $28;

vk_Select = $29;

vk_Print = $2A;

vk_Execute = $2B;

vk_SnapShot = $2C;

vk_Copy = $2C not used by keyboards }

vk_Insert = $2D;

vk_Delete = $2E;

vk_Help = $2F;

vk_A thru vk_Z are the same as their ASCII equivalents: 'A' thru 'Z' }

vk_0 thru vk_9 are the same as their ASCII equivalents: '0' thru '9' }

vk_NumPad0 = $60;

vk_NumPad1 = $61;

vk_NumPad2 = $62;

vk_NumPad3 = $63;

vk_NumPad4 = $64;

vk_NumPad5 = $65;

vk_NumPad6 = $66;

vk_NumPad7 = $67;

vk_NumPad8 = $68;

vk_NumPad9 = $69;

vk_Multiply = $6A;

vk_Add = $6B;

vk_Separator = $6C;

vk_Subtract = $6D;

vk_Decimal = $6E;

vk_Divide = $6F;

vk_F1 = $70;

vk_F2 = $71;

vk_F3 = $72;

vk_F4 = $73;

vk_F5 = $74;

vk_F6 = $75;

vk_F7 = $76;

vk_F8 = $77;

vk_F9 = $78;

vk_F10 = $79;

vk_F11 = $7A;

vk_F12 = $7B;

vk_F13 = $7C;

vk_F14 = $7D;

vk_F15 = $7E;

vk_F16 = $7F;

vk_F17 = $80;

vk_F18 = $81;

vk_F19 = $82;

vk_F20 = $83;

vk_F21 = $84;

vk_F22 = $85;

vk_F23 = $86;

vk_F24 = $87;

vk_NumLock = $90;

vk_Scroll = $91;

if not(Key in['0'..'9',#8]) then
begin
key:= #0; //空值
MessageDlg('请输入数字',mtError,mbOKCancel,0);
//MessageBeep(-1);
end;
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式