S
snb_ywx
Unregistered / Unconfirmed
GUEST, unregistred user!
type
TProductFieldList=(Midx,Idx,Barcode,DepotaddId,countx,RealCount);
TProductField=array[Midx..RealCount] of Variant;
ProductOp=class
private
FProducts:Tlist;
FProductOther:Tlist;
procedure AddRecord(SourceStr:string);
public
procedure LoadFromFile(FileName:string);
procedure ss;
constructor Create
overload;
destructor Destroy
override;
Property Products:TList read FProducts;
property ProductOther:TList read FProductOther;
end;
procedure TProductOp.AddRecord(SourceStr:string);
var
FFieldv:TProductFieldList;
i,l:integer;
vProduct:TProductField;
PProduct:^TProductField;
vsTemp:string;
begin
FFieldv:=Midx;
l:=length(SourceStr);
for i:=1 to l do
if ((SourceStr=',') or (i=l)) then
begin
vProduct[FFieldv]:=vsTemp;
vsTemp:='';
if FFieldv=RealCount then break
else FFieldv:=Succ(FFieldv);
end
else if SourceStr<>' ' then vsTemp:=vsTemp+SourceStr;
//PProduct:= @vProduct;
if vProduct[Midx]='' then FProductOther.Add(@vProduct)
else FProducts.Add(@vProduct);
//FProducts.Count
PProduct:=FProducts[FProducts.Count-1];
showmessage(PProduct^[barcode])
//此时间数据内有数据!
end;
以后再防问就防问不到了,问:
1、数组型变量离开这个过程之后是否被清空;
2、怎么样才能不被清空;
TProductFieldList=(Midx,Idx,Barcode,DepotaddId,countx,RealCount);
TProductField=array[Midx..RealCount] of Variant;
ProductOp=class
private
FProducts:Tlist;
FProductOther:Tlist;
procedure AddRecord(SourceStr:string);
public
procedure LoadFromFile(FileName:string);
procedure ss;
constructor Create
overload;
destructor Destroy
override;
Property Products:TList read FProducts;
property ProductOther:TList read FProductOther;
end;
procedure TProductOp.AddRecord(SourceStr:string);
var
FFieldv:TProductFieldList;
i,l:integer;
vProduct:TProductField;
PProduct:^TProductField;
vsTemp:string;
begin
FFieldv:=Midx;
l:=length(SourceStr);
for i:=1 to l do
if ((SourceStr=',') or (i=l)) then
begin
vProduct[FFieldv]:=vsTemp;
vsTemp:='';
if FFieldv=RealCount then break
else FFieldv:=Succ(FFieldv);
end
else if SourceStr<>' ' then vsTemp:=vsTemp+SourceStr;
//PProduct:= @vProduct;
if vProduct[Midx]='' then FProductOther.Add(@vProduct)
else FProducts.Add(@vProduct);
//FProducts.Count
PProduct:=FProducts[FProducts.Count-1];
showmessage(PProduct^[barcode])
//此时间数据内有数据!
end;
以后再防问就防问不到了,问:
1、数组型变量离开这个过程之后是否被清空;
2、怎么样才能不被清空;