I’m using Delphi 7. When I try to create an object in FormCreate, it fails (actually it just hangs). When I try to do the same thing in FormShow, it works. Please note, I’m not talking about creating a visual component like a TEdit. It’s a database abstraction object. Any ideas why this might happen? Are there any guidelines about this topic?
Share
1) The reason is because on FormCreate, the handle to Form is not created yet.
If your database object needs a form handle, do this:
Self.HandleNeeded; // on FormCreate time.
2) The other reason is maybe your database component needs to be connected and it’s only connected on DFM?