| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 776 人关注过本帖
标题:一个delphi字符串列表的问题
取消只看楼主 加入收藏
gddxbl
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2005-3-21
收藏
 问题点数:0 回复次数:0 
一个delphi字符串列表的问题

运行提示:project project1.exe raised exception class EAccessViolation with message 'Access violation at address 0041d0f4 in module' project1exe 下面是程序: 请大家看看有上面问题,谢谢 procedure TForm1.BitBtn1Click(Sender: TObject); var dwmc,dwmc1,anqclist:tstringlist; anqc,qlhqc,anq,anf,qlhq,qlhf:array[0..10] of Integer; zuohao,shengyu,a,b,c,d,i,j,k,m,n:integer; xx:tlocateoptions; max,max1,l1,l2,l3,l4,l5,l6,che:integer; l7,temp:real; s:string; begin dwmc:=Tstringlist.Create; dwmc1:=Tstringlist.Create;

t2.First; a:=2 ;

xx:=[loPartialKey] ; if not t2.Locate('bz','x',xx) then begin c:=3 ; if c > 4 then c:=c-4 ; t2.MoveBy(c); t2.Edit ; t2bz.Value:='x'; t2.Post; b:=c; end;

max:=t2.RecordCount; for i:=1 to max do begin dwmc.Append(t2dwmc.AsString); dwmc1.Append(t2dwmc.AsString); if not t2.Eof then t2.Next else t2.First; if t2.Eof then t2.First; end;

for i:=1 to max do begin if t4.Locate('dw',dwmc.Strings[i],xx) then begin anqc[i]:=t4aqc.AsInteger; anq[i]:=t4aq.AsInteger; anf[i]:=t4af.AsInteger; qlhqc[i]:=t4qq.AsInteger; qlhq[i]:=t4qx.AsInteger; qlhf[i]:=t4qf.AsInteger; anqclist.Append(t4aqc.AsString); end else begin anqc[i]:=0; anq[i]:=0; anf[i]:=0; qlhqc[i]:=0; qlhq[i]:=0; qlhf[i]:=0; end; end;

{%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%} l1:=0;l2:=0;l3:=0;l4:=0;l5:=0;l6:=6; k:=1; che:=1 ; m:=0;n:=0; {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}

for i:=1 to max do begin l1:=l1+qlhqc[i]; end; l2:=40 ; i:=1; while m=0 do begin d:=1 ; while d=1 do begin if qlhqc[i]>=l2 then begin qlhqc[i]:=qlhqc[i]-l2; for j:=1 to l2 do begin t3.Edit; t3.Append; t3.FieldValues['xh']:=j; t3.FieldValues['ch']:=che; t3.FieldValues['zwh']:=j+l3; t3.FieldValues['dwmc']:=dwmc.Strings[i]; t3.FieldValues['rq']:=date; t3.FieldValues['weizhi']:='七里河'; t3.FieldValues['qc']:='全程'; t3.FieldValues['fsrq']:=date; t3.Post; end; l2:=40; l3:=0;l4:=0; che:=che+1; d:=2; m:=1 end else begin if l2 >qlhqc[i] then begin l2:=l2-qlhqc[i]; l3:=l3+qlhqc[i]; for j:=1 to qlhqc[i] do begin t3.Edit; t3.Append; t3.FieldValues['xh']:=j; t3.FieldValues['ch']:=che; t3.FieldValues['zwh']:=j+l4; t3.FieldValues['dwmc']:=dwmc.Strings[i]; t3.FieldValues['rq']:=date; t3.FieldValues['weizhi']:='七里河'; t3.FieldValues['qc']:='全程'; t3.FieldValues['fsrq']:=date; t3.Post; end; l4:=l3; d:=2; end; end; end; i:=i+1; end;

{***************************}

n:=i ;

anqclist.Create; if m=1 then for n:=1 to max do anqclist.Append(inttostr(anqc[n]));

if m=1 then while not i> max do begin

dwmc1.Insert(0,dwmc.strings[i]) ; anqclist.insert(0,inttostr(qlhqc[i])); i:=i+1; end;

{*%%%%%%%%%%%%%%%%%%%%%%%*************}

temp:=0;

max1:=dwmc1.Count;

for i:=1 to max1 do temp:=temp+strtoint(anqclist[i]); l3:=0; l7:=int(temp/40+0.99); l5:=40; while l5>l7 do l5:=l5-1; label5.Caption:=inttostr(max1); l7:=int(temp/l5+0.99) ; l5:=40; while l5>l7 do l5:=l5-1; l2:=l5 ; label6.Caption:=inttostr(l5); {%%%%%%%%%%%%%%} for i:=0 to max1-1 do begin d:=1 ; while d=1 do begin if strtoint(anqclist.Strings[i])>=l2 then begin anqclist.Strings[i]:=inttostr(strtoint(anqclist.Strings[i])-l2); for j:=1 to l2 do begin t3.Edit; t3.Append; t3.FieldValues['xh']:=j; t3.FieldValues['ch']:=che; t3.FieldValues['zwh']:=j+l3; t3.FieldValues['dwmc']:=dwmc1.Strings[i]; t3.FieldValues['rq']:=date; t3.FieldValues['weizhi']:='安宁'; t3.FieldValues['qc']:='全程'; t3.FieldValues['fsrq']:=date; t3.Post; end; l2:=l5; l3:=0;l4:=0; che:=che+1; end else begin if l2 >strtoint(anqclist.Strings[i]) then begin l2:=l2-strtoint(anqclist.strings[i]); l3:=l3+strtoint(anqclist.strings[i]); for j:=1 to strtoint(anqclist.strings[i]) do begin t3.Edit; t3.Append; t3.FieldValues['xh']:=j; t3.FieldValues['ch']:=che; t3.FieldValues['zwh']:=j+l4; t3.FieldValues['dwmc']:=dwmc1.Strings[i]; t3.FieldValues['rq']:=date; t3.FieldValues['weizhi']:='安宁'; t3.FieldValues['qc']:='全程'; t3.FieldValues['fsrq']:=date; t3.Post; end; l4:=l3; d:=2; end; end; end; end;

{%%%%%%%%%%%%%%}

end;

搜索更多相关主题的帖子: delphi 字符 列表 integer dwmc 
2005-03-21 17:16
快速回复:一个delphi字符串列表的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016323 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved