Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Programmatically add controls to a form
Message
From
20/05/2002 15:49:30
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Programmatically add controls to a form
Miscellaneous
Thread ID:
00659070
Message ID:
00659070
Views:
72
We are in the process of installing our VFP7 app which is a conversion of an FPD26 app. Everything is fine, but I need to streamline some changes made by the installer for setting up printers for use in vfp7 when installing the new app.

In the old dos version, a local table was used to store the printer port that reports were sent to in the field cn_port. In the VFP version, the field cn_port stores the 'printer name' instead of course. What I want to do is pull all distinct records (so that I can see what ports were used in the dos version) and throw them into test boxes on a form. For example, if the workstation had 4 printer ports used (lpt1-lpt4) in the old dos version then the form would have one column of four text boxes on the form - one for each port used. Across from each text box would be a combo box where the installer would select the current windows printer name to change the value of cn_port to. For instance, if in the dos version the report "transmittals" was printed to lpt1 but in the windows version the report "transmittals" would go to the hp laserjet 4000, the user would pick the hp laserjet 4000 from the dropdown list in the combobox across from the lpt1 textbox.

I am pulling distinct values from a free table using the following:
sele distinct cn_port from lcontrol
The resulting query contains DOS printer ports in the field cn_port that were used in an FPD26 app. My problem is that there are 500 users out there and each one is different. One dos user could have lpt1 used on only, while another dos user could have any number of printers setup. I will have to programmatically throw the text boxes on the form. How to do that? The other option was a grid with column one being a textbox containing the distinct cn_port values from the local table (on record for each), and column two would be a combo box populated with aprinters(). I don't like the idea of a grid, I think the textboxes and comboboxes directly on the form would be best. So, if I have my query with the field cn_port populated with distinct values from the field cn_port in the free table lcontrol and the total record count is 4, how do I throw 4 textboxes on the form - one for each record?
Any ideas? I need to have the comboboxes logically named too so I can then grab the value from each, the value from each text box, and step through the local control table searching for the old dos value (contained in the textbox) and replacing it with the value in the correcponding combobox. I thought of assuming there would never be more than 10 dos printers assigned and putting the controls on a form and hiding the ones not used. If there are only four records then disabling the lower 6 for instance.
TIA!!
Tracy
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Next
Reply
Map
View

Click here to load this message in the networking platform