Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DLL Question
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Titre:
Divers
Thread ID:
00262172
Message ID:
00262381
Vues:
14
>I would like to use a DLL to open the tables
>used in my form. I found that the data seems
>to be unavailable to the form when opened from
>within the DLL.
>
>Am I doing something wrong? Is what I want to do
>even possible?

No.. actually, you are doing it right. What you are doing is creating a Business Object. A class the controls the access to certain data. But, you are trying to take a short cut. The form instantiates the Business Object. The Business Object manages and contains the data.

You have asked the classic question... How do I provide a UI of the data managed by a BizObj deployed as a COM server.

There are several ways to do it.

1. Create a property in your BizObj for Each field in the table it controls. For example, if you have a Customer Table, your Customer BizObj would have properties such as...

this.FirstName, this.LastName, this.PhoneNumber etc...

In your BizObj you will need a method to refresh these values when the record pointer moves or the file is first open... It might look like this...

* Method RefreshPersistentProperties()
this.FirstName = Customers.Firstname
this.LastName = Customers.Lastname
this.PhoneNumber = Customers.PhoneNumber
etc...

Now, what about your form... In the Init of your form create and instance of your business object. Have a property on your form to store a reference to the BizObj...

this.oBizObj = createobj('MyDLL.CustomerBizObj')

Then, you can bind your controls to the properties of the BizOBj... for eamble, the control source of your LAstName text filed would be ...

=thisform.oBizObj.LastName

**********
Another method other than the RefreshPersistentProperties() method would be to use access and assign methods. Each persistent property (property for a field) would have an access and assign method. The access method would get the value from the table/view... The assign method would put the value into the table/view.

****************************
Well, this should get you started... this method should be decent if you are using .DLL's for your BizOBjs that you put on the workstation. If you are delopying remote BizObjs (.EXE or MTS) the above might be a bit slow... YMMV.

BOb
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform