Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

W"rite From Memo Box

Status
Not open for further replies.

gforrest

Programmer
Apr 26, 2000
39
CA
Hi Guys,
I'm using the following code to read some info from a file, which I access via a structure, into a Memo Box and then write new info from the Memo Box back to the file. The read portion under Form Activate works OK but when I attempt to write using the 'EdtLgOkBtnClick' procedure I get an, "Access Violation" error. Any thoughts on how to cure this would be appreciated.

PS. I can't use LoadFromFile and LoadToFile here.

procedure TEdtLgFrm.FormActivate(Sender: TObject);
var
val : Integer;
RecINFO : INFO;
i : Integer;
StrArray : Array[0..40] of Char;
PStrArray : PChar;

begin
PStrArray := @StrArray;
EdtLgMb.Clear;
for i := 0 to 7 do
begin
read_options(@RecINFO);
Move(RecInfo.Logo[i,0],StrArray[0],41);
EdtLgMb.Lines.Add(string(PStrArray));
end;
end;

procedure TEdtLgFrm.EdtLgOkBtnClick(Sender: TObject);
var
RecINFO : INFO;
i : Integer;
StrArray : Array[0..40] of Char;
PStrArray : PChar;
begin
if EdtLgMb.Lines.Text = '' then
begin
ShowMessage('Please Enter New Logo Information or Press EXIT');
Exit;
end
else
PStrArray := @StrArray;
read_options(@RecINFO);
EdtLgMb.Lines.Add(string(PStrArray));
Move(RecInfo.Logo[i,0],StrArray[0],41);
write_options(@RecINFO);
end;

end.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top