Symptom
The following code fails to print and the application did not respond.
Int i_res Int PrintJobNumber PrintJobNumber = PrintOpen('Nav Report',true) if printjobnumber = -1 then return // Print the string Vehicle registration and Driver i_res = Print(PrintJobNumber,"Delivery Report: For Vehicle: " ) i_res = PrintPage(PrintJobNumber) i_res = PrintScreen(PrintJobNumber, 500,1000) // Close the job. i_res = PrintClose(PrintJobNumber)
Environment
PowerBuilder
Cause
The Job number is incorrect because data types do not match. The function PrintOpen returns a Long, but you assign it to an Int type variable, this causes it to get incorrect job number, thus cause the issue.
Solution
Modify the PrintJobNumber declaration as follows:
Long PrintJobNumber