I have a StrinGrid component and a procedure:
procedure TForm3.StringGrid1Click(Sender: TObject);
begin
SelectedElement := stringgrid1.Cells[0,stringgrid1.Row];
end
SelectedElement is declared in public section:
public
SelectedElement : String;
end;
When I use it in this unit, for example Label1.Caption := SelectedElement
, it works fine. But in another unit, where I specified uses unit1
in implementation
, and I try to use this variable like this Label1.Caption := Form1.SelectedElement
it sets label to empty string. But when I set variable manually for example on first form create, then this value shows up in second form, even if variable is later changed to value from stringgrid.