Solved

Problem with Data Module

Posted on 1998-09-22
3
193 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now