Question

I am trying to write simple program in Visual FoxPro, I am using built in Help, but cannot find an answer there. There are dozens of samples but they all work with forms, and I just need something like console.out() or printf().

While looking for some samples on internet, found this:

? 2 + 2

This line supposed to print 4, but nothing happens when the program is run from the menu or tool bar.

Was it helpful?

Solution 2

Type this into the Command text box and press Enter. Close all opened tables (if any) in order to see 4.

OTHER TIPS

In the command window, type "set device to screen"
You can create a program, may be called "start.prg" including the line above in the program. This is run everytime Foxpro is started from Desktop.

Click on Tools, Options, File locations, Startup Program,then "modify" and enter the location of the "start.prg", for example, C:\Program Files\Microsoft Visual Foxpro 9\start.prg

******to print to paper *********************************************        
        set device to printer                                              
        set printer to   &&&  turn off all open print commands            
        ???" "             &&& open printer in raw mode                     
        p_Landscape_On =chr(27)+"&l1O"                                  
        p_Landscape_Off =chr(27)+"&l0O"                                     
        n_Row=2                                          
        @n_Row, 1 say (p_Landscape_On) +(p_Draft)+(p_14inPaper)             
        n_Row=n_Row+1                                        

******end of printing*****************************                         
         @n_Row,n_Col_fav say (p_Landscape_Off)+(p_12CharPerInch)+p_Portrait)
         set printer to                                             
         set device to screen 

? is the correct way to display on screen. It will display on the next line of the current main window.

If you are getting no results try SET CONSOLE ON before your ?2+2

Another option, depending on your needs, is to use a WAIT WINDOW, ie WAIT WINDOW 'test'

You can also try ACTIVATE SCREEN prior to printing your text.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top