首页 新闻 论坛 群组 Blog 文档 下载 读书 Tag 网摘 搜索 .NET Java 游戏 视频 人才 外包 培训 数据库 书店 程序员
中国软件网
欢迎您:游客 | 登录 注册 帮助
  • 抢分啦 delphi 生成文本文件 问题 [已结贴,结贴人:zrx154330720]
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    • zrx154330720
    • 等级:
    • 可用分等级:
    • 总技术分:
    • 总技术分排名:
    • 揭贴率:
    发表于:2008-08-23 22:35:16 楼主
    我做的一个小程序中我点一下确定 生成6个数字
    分别放在 6个Label中
    现在我像要吧着6个Label.caption的值存到文本文件中
    但是要求他们在一行 数与数之间留 一个空格 就像这样 10 12 13 14 15 17
    这样要怎么弄啊
    向高手请教
    20  修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    • lynmison
    • 等级:
    • 可用分等级:
    • 总技术分:
    • 总技术分排名:
    发表于:2008-08-23 23:11:541楼 得分:20
    Delphi(Pascal) code
    var i: integer; f: textfile; tmp: string; begin tmp := ''; for i:=1 to 6 do begin if (FindComponent(Format('Label%d',[i]))<>nil) and (FindComponent(Format('Label%d',[i])) is TLabel) then tmp := tmp+TLabel(FindComponent(Format('Label%d',[i]))).Caption+' '; end; tmp := LeftStr(tmp,Length(tmp)-1); //去掉最后一个多余空格 assignfile(f,'c:\aa.txt'); rewrite(f); write(f,tmp); closeFile(f);
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    • jacknes009
    • 等级:
    • 可用分等级:
    • 总技术分:
    • 总技术分排名:
    发表于:2008-08-24 01:49:552楼 得分:0
    LSZJ

    var
      i: integer;
      f: textfile;
      tmp: string;
    begin
      tmp := '';
      for i:=1 to 6 do
      begin
        if (FindComponent(Format('Label%d',[i])) <>nil) and (FindComponent(Format('Label%d',[i])) is TLabel) then
          tmp := tmp+TLabel(FindComponent(Format('Label%d',[i]))).Caption+' ';
      end;
      tmp := LeftStr(tmp,Length(tmp)-1);  //去掉最后一个多余空格
      assignfile(f,'c:\aa.txt');
      rewrite(f);
      write(f,tmp);
      closeFile(f);
    修改 删除 举报 引用 回复

    网站简介广告服务网站地图帮助联系方式诚聘英才English 问题报告
    北京创新乐知广告有限公司 版权所有 京 ICP 证 070598 号
    世纪乐知(北京)网络技术有限公司 提供技术支持
    Copyright © 2000-2008, CSDN.NET, All Rights Reserved