How can I set the current page of a TPageControl?

Satch3000 picture Satch3000 · May 26, 2011 · Viewed 19.9k times · Source

I am using a pagecontrol component and I need to add a button and click it to go to a specified page.

How can I do this please?

Answer

David Heffernan picture David Heffernan · May 26, 2011

Add a button to the form and write an OnClick event handler like this:

procedure TMyForm.Button1Click(Sender: TObject);
begin
  PageControl1.ActivePage := TabSheet1;
end;