System: Windows XP, AMD Sempron +2800 , nVidia GeForce FX 5500
Compiler/IDE: Delphi 2006 for Win32
API: DelphiX

Did not find any info, so I'm going to ask here:
I'm loading my main map from a text file in the onFormCreate event:
[pascal]procedure TForm22.FormCreate(Sender: TObject);
begin
form22.setupmap(mapfile);
end;[/pascal]

with this procedure:
[pascal]
procedure tform22.SetupMap(MapFile:string);
var stream:TFilestream;
C : Char;
x, y : Word;
tempbuffer : array[ 0..32, 0..24 ] of Char;
begin
Stream:=tfilestream.Create(mapfile, fmopenread);

try
try
for y:=0 to 24 do
begin
for x := 0 to 31 do
begin
stream.ReadBuffer(C, SizeOf(C));
tempbuffer[x][y]:=c;

end;
end;
except on e:exception do
messagedlg(e.Message, mterror, [mbok], 0);
end;
finally
stream.free
end;

for y := 0 to 25 do
begin
for x := 0 to 32 do
begin
case tempbuffer[x][y] of
//grass
'0':
begin
map[x][y].Tile:=0;
end;
//path
'1' :
begin
map[x][y].Tile:=1;
end;
//water
'2' :
begin
map[x][y].Tile:=2;
end;
end;
end;
end;


end;
[/pascal]

but since one map in game is not good, I want to load different maps. I tried loading them in doLoad procedure, like this:
[pascal]
procedure doLoad;
begin
form22.SetupMap('map.map');
gamestate:= gsgame;
end;


//and I try to engage the doLoad procedure like this

procedure TForm22.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
...
//other keys that control menu
...
if (key = vk_space) and (gamestate = gsgame) then
begin
gamestate:= gsload;
end;
end;
[/pascal]

but everytime I only get a "stream read error".
I guess I'm could use some kind of simple procedure, but I can't think of any.
Cheers, leniz[/pascal]