Access violation

edited 10:43PM in FastReport 3.0
A Have Access violation with this example code:

AnsiString form=ExtractFilePath(Application->ExeName)+"\\Forms\\exam.fr3";
frxReport1->LoadFromFile(form, True);
// frxReport1->PrepareReport();
((TfrxMemoView*)frxReport1->FindObject("MemoTo1"))->Text =
Edit1->Text.SubString(1,1).Trim();
// frxReport1->PrepareReport();
frxReport1->ShowReport();

I thing that problem is this line:
((TfrxMemoView*)frxReport1->FindObject("MemoTo1"))->Text =
Edit1->Text.SubString(1,1).Trim();

Please help. What I am doing wrong?
Stan

Comments

  • edited April 2006
    Report can't find object with name "MemoTo1".
    TfrxMemoView * memo;
    if(NULL==(memo = (TfrxMemoView*)frxReport1->FindObject("MemoTo1"))) //if memo = NULL then report can't find object
    memo->Text = Edit1->Text.SubString(1,1).Trim();
    
    frxReport1->ShowReport();
    

Leave a Comment