Hi, I'm trying to write a program that uses 2 forms. The idea is when you click on one of the edit boxes in form1 and press Enter form2 pops out(form 2 has a dbgrid that shows the content of a table in mysql database). When click on a row in the dbgrid in form2 the values of the table(it contains 2 fields kod and name) should be assigned to edit boxes in form1. The code i use is:
for form1:
unit Unit1;
uses
Classes, SysUtils, db, sqldb, mysql50conn, FileUtil, Forms, Controls,
Graphics, Dialogs, ExtCtrls, StdCtrls, ComCtrls, DBGrids, unit2, LCLType;
....
procedure TForm1.Edit3KeyPress(Sender: TObject; var Key: char);
begin
if Key= #13 then
form2.showmodal;
end;
And in form2 I use:
uses
Classes, SysUtils, db, sqldb, unit1, mysql50conn, FileUtil, Forms, Controls,
Graphics, Dialogs, DBGrids, StdCtrls, ComCtrls;
...............................................................
procedure TForm2.DBGrid1CellClick(Column: TColumn);
begin
form1.Edit3.Text:=DBGrid1.Columns[0].Field.AsString;
form1.Edit4.Text:=Dbgrid1.Columns[1].Field.AsString;
end;
But I get the following error message:"unit2.pas(8,38) Fatal: Circular unit reference between Unit2 and Unit1"
When I delete unit1 from the uses clause in form2 Lazarus doesn't recognize form1.Edit3.Text:=DBGrid1.Columns[0].Field.AsString;
If anyone has ideas how to deal with this I'd be very grateful.