FoxPro Program For Printing Labels – LblPrint
This is a very simple label printer application I wrote for work. I don’t have the code for download, because it’s a very specific application, and probably won’t work for you, but it does showcase some of the powerfull features of Foxpro.
Here is how it works:
The user enters a search term, then clicks the search button. The program connects to the Sql Server 2000 database, retrieves the data, and populates the data grid. The user then selects the record desired and the label preview is generated. On every record selection the preview is automatically generated. The user can then select a modifier by clicking on one of the radio buttons to the right of the preview container. On each change of the modifier the preview is automatically updated. The user then clicks the print button and the label is sent to the label printer and the cursor is automatically placed in the search box.
Prior to printing, the user can can select the desired printer and paper size using the Print Setup button. Being able to select or change printer settings is very important, because some of the users use this application through a terminal server session. The label printer is attached to their local workstation and gets mapped from the terminal server back to their PC when they log on. Since the name of the printer is not known until after the user logs on, it would be difficult to hardcode the printer in the report file. By being able to make printer changes at runtime, it makes it easy for the user to chooses his or her printer after they log on. They only do this the first time, as once the settings are changed, they are saved in the lbx file until the next time they need to be updated.
For more information on the reporting capabilities of VFP 9, please check out this great article:
Techniques for an alternative Report Preview UI
Also, take a look at the SYS(1037) function in the FoxPro help file.
Here are some screenshots of the program. (click to enlarge)










