紧急求助,高手请进来帮忙看看。很着急。
type
wysdata=record
wyname:string;
wymj:real;
mpmdj:real ;
yzzje:real;
glmpmdj:real ;
glzje:real ;
fz:integer ;
sb :integer ;
sblist:tstrings ;
db :integer ;
dblist:tstrings ;
mq :integer ;
mqlist :tstrings ;
dh :integer ;
dhlist :tstrings ;
end;
save:array of wysdata ;
//取出数据
procedure Thtdj.ComboBox4Change(Sender: TObject);
var i:integer ;
wy:wysdata;
tpst:tstrings ;
begin
listbox2.Clear ;listbox3.Clear ;listbox4.Clear ;listbox5.Clear ;
if combobox4.Text<>'' then
begin
speedbutton2.Enabled :=true ;
wy :=save[combobox4.ItemIndex];
edit24.Text :=inttostr(wy.sb );
edit25.Text :=inttostr(wy.db );
edit26.Text :=inttostr(wy.mq );
edit27.Text :=inttostr(wy.dh );
if wy.sblist<>nil then
begin
showmessage(inttostr(wy.sblist.Count)) ;《-----这里还是报错啊,内存错误,只要使用wy.sblist就报错。装载数据就不会有这个问题。
end;
// if wy.dblist<>nil then
// listbox3.Items.Assign(wy.dblist) ;
// if wy.mqlist<>nil then
// listbox4.Items.Assign(wy.mqlist) ;
// if wy.dhlist<>nil then
// listbox5.Items.Assign(wy.dhlist) ;
end;
end;
//装载数据
procedure Taddsb.SpeedButton6Click(Sender: TObject);
var i:integer ; wy:wysdata;
begin
with ut_htdj.htdj do
begin
wy :=save[combobox4.ItemIndex];
listbox2.Items :=addsb.listbox1.Items ;
listbox3.Items :=addsb.listbox2.Items ;
listbox4.Items :=addsb.listbox3.Items ;
listbox5.Items :=addsb.listbox4.Items ;
if wy.sblist<>nil then
begin
wy.sblist := addsb.ListBox1.Items ;
end;
if wy.dblist<>nil then
wy.dblist :=addsb.ListBox2.Items ;
if wy.dhlist<>nil then
wy.dhlist :=addsb.ListBox4.Items ;
if wy.mqlist<>nil then
wy.mqlist :=addsb.ListBox3.Items ;
save[combobox4.ItemIndex]:=wy ;
end;
if ut_data.wygl_data.jlsb.Active then ut_data.wygl_data.jlsb.Close ;
addsb.Close ;
end;