I'm making a mdi application with many child forms, one of which is the form to display the report. on the report form I use dll files to display all the components on the form and look for value in each component, I use the following code to do that.
// this code i write in dll or bpl file
procedure getReportParams(Form : Tform); stdcall;
var
i : integer;
str, cbstr : string;
b : boolean;
begin
for i:=0 to Form.ComponentCount-1 do
  begin
  str:=str+Form.Components[i].Name+' - '+Form.Components[i].ClassName+', ';
      if (Form.Components[i] is TcxLookupComboBox) then
          begin
          showmessage('test 1');
          // if i uncomment the code below, the program get error Einvalidcast 
          // cbstr:=(Form.Components[i] as TcxDBLookupComboBox).Text;
          // if (Form.Components[i] as TcxDBLookUpCombobox).Parent=Form.FindComponent('pnledit') then
          //     showmessage((Form.Components[i] as TcxDBLookUpCombobox).Name);
          end;
  end;
showmessage(str);
// this showmessage work well in dll, bpl, or other unit
if b then
showmessage(cbstr+' true') else showmessage(cbstr+' false');
end;
simple question is how to write code cbstr:=(Form.Components[i] as TcxDBLookupComboBox).Text; with corecly without get EInvalidCast error?
Btw if i write this code in other unit, dll and bpl program get error but if i write that code in same unit (unit report) the code work well. thank for advance.
 
     
     
    