C
Christian Correa
Hi all,
If you've used the ODBC DSN wizard, you've seen that there is a button which
lets you test a data connection. I want to create a dialog with the same
funcionality; to know if a connection to a database was made succesfully.
The form has to render itself completely first, then attempt a connection,
and finally update some label with the result of the operation
(Success/Failure). After that, an OK button is enabled and the user knows
the connection attempt has ended either successfully or not.
I placed all related code in the Load event, just to realize this code gets
executed before the form is rendered. I actually want to display all
elements first as a visual cue that the program is attempting a connection.
So using the Load event was not the solution.
I then placed all related code in the Activated event, which to my
understanding happens after Load and after the form is shown. Indeed, the
window frame and title bar are displayed; but I've noticed that the form
does not render itself completely--you get a white or gray block instead of
the form's contents. I believe that because the program is trying to connect
to a database, that action takes precedence and that is somehow preventing
the form controls to be rendered.
Is there an alternative event where I can place this code, just so that
every element is displayed completely in the form first; and then proceed
with the connection attempt? How can I "wait" until everything is rendered?
Any pointer would be appreciated. Thanks,
-Christian Correa
If you've used the ODBC DSN wizard, you've seen that there is a button which
lets you test a data connection. I want to create a dialog with the same
funcionality; to know if a connection to a database was made succesfully.
The form has to render itself completely first, then attempt a connection,
and finally update some label with the result of the operation
(Success/Failure). After that, an OK button is enabled and the user knows
the connection attempt has ended either successfully or not.
I placed all related code in the Load event, just to realize this code gets
executed before the form is rendered. I actually want to display all
elements first as a visual cue that the program is attempting a connection.
So using the Load event was not the solution.
I then placed all related code in the Activated event, which to my
understanding happens after Load and after the form is shown. Indeed, the
window frame and title bar are displayed; but I've noticed that the form
does not render itself completely--you get a white or gray block instead of
the form's contents. I believe that because the program is trying to connect
to a database, that action takes precedence and that is somehow preventing
the form controls to be rendered.
Is there an alternative event where I can place this code, just so that
every element is displayed completely in the form first; and then proceed
with the connection attempt? How can I "wait" until everything is rendered?
Any pointer would be appreciated. Thanks,
-Christian Correa