Показать сообщение отдельно
  #4  
Старый 19.11.2008, 11:48
Deathwatcher Deathwatcher вне форума
Прохожий
 
Регистрация: 18.11.2008
Сообщения: 2
Репутация: 10
По умолчанию

поразбиравшись в проге я выяснил, что вот такой код

Код:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    ListBox1: TListBox;
    ListBox2: TListBox;
    ListBox3: TListBox;
    ListBox4: TListBox;
    ListBox5: TListBox;
    ListBox6: TListBox;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    procedure FormActivate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

type
  TQuestion = Record
    index:integer;
    tekst:string[255];
    right:string[255];
    wrong1:string[255];
    wrong2:string[255];
    wrong3:string[255];
  end;

var
  Form1: TForm1;
  quest: array of TQuestion;
  MyFile:file of TQuestion;
  count, maxcount:integer;

implementation

{$R *.dfm}

procedure TForm1.FormActivate(Sender: TObject);
begin
count:=0;
Assignfile (Myfile, 'voprosiki.ggt');
reset(myfile);
SetLength(quest,2);
read(myfile,quest[0]);
maxcount:=StrToInt(quest[0].right);
SetLength(quest,maxcount+1);
reset(myfile);

while not Eof(myfile) do
begin
read(myfile,quest[count]);
listbox1.Items.Add(IntToStr(quest[count].index));
listbox2.Items.Add(quest[count].tekst);
listbox3.Items.Add(quest[count].right);
listbox4.Items.Add(quest[count].wrong1);
listbox5.Items.Add(quest[count].wrong2);
listbox6.Items.Add(quest[count].wrong3);
inc(count);
end;

end;

end.

считывает файл верно. Однако если подобное считывание (от объявления типов, массивов и переменных до самого считывания) разместить на второй форме проекта, которая вызывается из основной посредствам

Код:
form2.showmodal  

То файл не считывается!...
Ответить с цитированием