Linuxuser1234 1 Posted January 6, 2023 Im trying to communicate with a component in Unit1 from Unit4 but when i click on the button i get a access violation error how can i resolve this procedure TForm4.Button1Click(Sender: TObject); var Label21: Tlabel; Button1: Boolean; ProgressBar1 : TProgressBar; begin // ProgressBar1.Visible := True; //Component is in Unit1 (Bolt) end; Share this post Link to post
Brian Evans 105 Posted January 6, 2023 (edited) Nothing shown references a component in another unit. I only see a local ProgressBar1 defined in the Var section of your procedure that isn't created / initialized so will throw access violations when an attempt it made to reference/access it. Usually you would put the other form unit in the Uses clause of the implementation section of the form you want to reference it from. Then use the form variable to access it like Form1.ProgressBar1.Visible := true;. implementation {$R *.dfm} uses Unit1; Edited January 6, 2023 by Brian Evans 1 Share this post Link to post