Solved

Problem with Data Module

Posted on 1998-09-22
3
195 Views
Last Modified: 2010-04-06
D3/NT4.  I have an MDI app.  One form is the login form which sets ups a global login for the app.  This form accepts username/password, etc and will then pass it to a Data Module which has a 3rd party login and session component on it.  My problem is that I can't seem to access the datamodule from the MDI form.  I have added the datamodule to the implementation USES clause.

When I access the datamodule, it's something like this:

datamodule.componentName.variable := value;

This compiles OK, however at runtime, the value of the datamodule is nil.  I don't have a windows handle to access the datamodule components.  How do I get the handle.
I normally would use something like MDIChilren to get the handle for a MDI child window, but this isn't a window, it's a data module.  What do I need to do?
Please be specific...
Thanks
George
0
Comment
Question by:gspears060598
3 Comments
 

Accepted Solution

by:
gdebiasa earned 100 total points
ID: 1340572
Is your datamodule being Auto-Created (under Project Options)? If it's not, that's your problem. Either auto-create it or explicitly create it before you try to use it (using DataModule.Create, for example).

DataModules are essentially just special types of forms, so I suspect that the rules that apply to forms, also apply to DataModules.

Glen
0
 
LVL 1

Expert Comment

by:pjdb
ID: 1340573
In the same way, the data module creation can be too late. I mean the MDI form is created at the begining of the main program (in the dpr file) and during the creation you try to access to the datamodule which is created after that.
I think that you'd better to ask for the username/password in the data module creation so that it will be created before any acess to it.
0
 

Author Comment

by:gspears060598
ID: 1340574
That was it... An easy 100 points <g>

0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

805 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question