Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8540907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:42:18+00:00 2026-06-11T11:42:18+00:00

I would like to know where is the formshow in delphi 2010 as when

  • 0

I would like to know where is the formshow in delphi 2010 as when I can only see a formcreate in my project.

The reason I am asking is because I need to add Randomize in the FormShow event handler, as shown below:

procedure TfrmWinnaSpree.FormShow(Sender: TObject);
begin
  Randomize;
end;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T11:42:19+00:00Added an answer on June 11, 2026 at 11:42 am

    You create the event handler the same way you create almost every event handler in Delphi, by double-clicking the method in the Events tab of the Object Inspector.

    Click on the form itself (not any control on the form), then switch to the Object Inspector. Click on the Events tab, and then scroll down to the OnShow event. Double-click in the right half next to the event name, and the IDE will create a new, empty event handler and put the cursor in the right place to start writing code.

    Object Inspector OnShow image

    procedure TForm3.FormShow(Sender: TObject);
    begin
      |
    end;
    

    However, FormShow is the wrong place to call Randomize, because FormShow executes every time your form is shown, and that can happen more than once. Here’s an example (it assumes two forms, Form1 and Form2, autocreated as usual in the .dpr file with the default variable names, which of course is a bad idea – this is to demonstrate a problem with your question’s purpose):

    procedure TForm2.FormShow(Sender: TObject);
    begin
      ShowMessage('In FormShow');
    end;
    
    
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      Form2.Visible := not Form2.Visible;
    end;
    

    Run the program and click TForm1.Button1 multiple times; you’ll see the In FormShow message every other time you do so.

    The proper places for a call to Randomize are:

    • in your main form’s FormCreate
    • in an initialization section of your main form’s unit

      unit uMainForm;
      
      interface
      
        ...
      
      implementation
      
        ...
      
      initialization 
      
      Randomize;
      
      end.
      
    • in your project source (.dpr) file

      program MyGreatApp;
      
      uses
        Math,
        Vcl.Forms,
        uMainForm in 'uMainForm.pas' {Form1};
      
        {$R *.RES}
      
      begin
        Randomize;
        Application.Initialize;
        Application.MainFormOnTaskbar := True;
        Application.Title := 'My Super App';
        Application.CreateForm(TForm1, Form1);
        Application.Run;
      end.
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i would like know some reference. I know i can googling it. but prefer
I would like to know, how can we change the SRC url for IFRAME
I would like to know that how we can check the available memory in
I would like know the limit of maximum number of rows that can be
i would like know how can i add a style when a item of
would like to know how can this be implemented in Joomla. I have a
I would like to know if there is a way to return only the
I would like to know how can i set the coord of a c++
i would like to know how can I get a new map that is
I would like know whether we can highlight text (colors) of already created PDF

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.