procedure TFormMain.FormCreate(Sender: TObject);
var
MyIniFile :TIniFile;
mySolutionIniFile :string;
begin
mySolutionIniFile := ExtractFilePath(Application.ExeName) + 'NetConfig.ini';
try
MyIniFile := TIniFile.Create(mySolutionIniFile);
cmbx_FormStyle.ItemIndex := MyIniFile.ReadInteger('系统配置','cmbx_FormStyle',1);
cmbx_SolutionList.ItemIndex := cmbx_SolutionList.Properties.Items.IndexOf(MyIniFile.ReadString('系统配置','cmbx_SolutionList',''));
finally
MyIniFile.Free;
end;
end;
为何我这样写会出现“[Warning] frmMain.pas(171): Variable 'MyIniFile' might not have been initialized”这样的警告呢?怎样才能消除这个警告啊?
var
MyIniFile :TIniFile;
mySolutionIniFile :string;
begin
mySolutionIniFile := ExtractFilePath(Application.ExeName) + 'NetConfig.ini';
try
MyIniFile := TIniFile.Create(mySolutionIniFile);
cmbx_FormStyle.ItemIndex := MyIniFile.ReadInteger('系统配置','cmbx_FormStyle',1);
cmbx_SolutionList.ItemIndex := cmbx_SolutionList.Properties.Items.IndexOf(MyIniFile.ReadString('系统配置','cmbx_SolutionList',''));
finally
MyIniFile.Free;
end;
end;
为何我这样写会出现“[Warning] frmMain.pas(171): Variable 'MyIniFile' might not have been initialized”这样的警告呢?怎样才能消除这个警告啊?
var
MyIniFile :TIniFile;
mySolutionIniFile :string;
begin
mySolutionIniFile := ExtractFilePath(Application.ExeName) + 'NetConfig.ini';
MyIniFile := TIniFile.Create(mySolutionIniFile);
try
cmbx_FormStyle.ItemIndex := MyIniFile.ReadInteger('系统配置','cmbx_FormStyle',1);
cmbx_SolutionList.ItemIndex := cmbx_SolutionList.Properties.Items.IndexOf(MyIniFile.ReadString('系统配置','cmbx_SolutionList',''));
finally
MyIniFile.Free;
end;
end;