Hello,
I'm new to Lazarus, I did a lot of programming in Delphi 7. Now I started to write my programs from Delphi to Lazarus, but I faced a very strange thing.
My program loads a text file to a stringlist. Then from this stringlist I need some lines as a string. I give these values to different strings. Then my program goes on and after a few more lines in the program when I check my string values I can see, that they are all ???... I suppose that means that they are empty. It is a really simple code, I don't know what could cause the problem. Please help me!
oD:=TOpenDialog.Create(self);
oD.InitialDir := GetCurrentDir;
oD.Title:='Kérem válassza ki a mérési fájlt!';
oD.Filter:='Txt fájlok|*.txt';
oD.Execute;
list:=TStringList.Create;
list.LoadFromFile(oD.FileName);
tr:=AnsiMidStr(list[0],22,length(list[0])-21);
d:=AnsiMidStr(list[10],15,length(list[10])-14);
fn:=ExtractFileName(oD.FileName);
dl:=TStringList.Create;
dl.Delimiter:='.';
dl.DelimitedText:=d;
For w:=0 To 20 Do
Begin
If AnsiLeftStr(fn,4)='left' Then
Begin
If (AnsiMidStr(list[w],19,length(list[w])-18)='vorwärts') And (AnsiMidStr(list[w+1],20,length(list[w+1])-19)='steigend') Then
Begin
oldbj:='b';
Break;
end
Else If (AnsiMidStr(list[w],19,length(list[w])-18)='rückwärts') And (AnsiMidStr(list[w+1],20,length(list[w+1])-19)='fallend') Then
Begin
oldbj:='b';
Break;
end
Else If (AnsiMidStr(list[w],19,length(list[w])-18)='vorwärts') And (AnsiMidStr(list[w+1],20,length(list[w+1])-19)='fallend') Then
Begin
oldbj:='j';
Break;
end
Else If (AnsiMidStr(list[w],19,length(list[w])-18)='rückwärts') And (AnsiMidStr(list[w+1],20,length(list[w+1])-19)='steigend') Then
Begin
oldbj:='j';
Break;
end;
end
Else If AnsiLeftStr(fn,4)='righ' Then
Begin
If (AnsiMidStr(list[w],19,length(list[w])-18)='vorwärts') And (AnsiMidStr(list[w+1],20,length(list[w+1])-19)='steigend') Then
Begin
oldbj:='j';
Break;
end
Else If (AnsiMidStr(list[w],19,length(list[w])-18)='rückwärts') And (AnsiMidStr(list[w+1],20,length(list[w+1])-19)='fallend') Then
Begin
oldbj:='j';
Break;
end
Else If (AnsiMidStr(list[w],19,length(list[w])-18)='vorwärts') And (AnsiMidStr(list[w+1],20,length(list[w+1])-19)='fallend') Then
Begin
oldbj:='b';
Break;
end
Else If (AnsiMidStr(list[w],19,length(list[w])-18)='rückwärts') And (AnsiMidStr(list[w+1],20,length(list[w+1])-19)='steigend') Then
Begin
oldbj:='b';
Break;
end;
end;
end;