Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

missing lines on printout

Status
Not open for further replies.

shalet

Programmer
Nov 22, 2003
6
0
0
GB
Using my home laptop, everything prints as it should.
Taking the programme written in VB6 to my PC at work, some variables just wont print. The same ones on each try, but no clue as to why.
Then I tried a code listing, some lines (random it seems) don't appear on paper, just a blank line. Trying a second print of the code, and the same lines are missing!
e.g.
FOR a = 1 TO 9
IF a = 1 PRINTER.PRINT "low"

NEXT a
The blank line should show
IF a = 9 THEN PRINTER.PRINT "high"

Any thought might keep my hair in place!
Geoffrey
 
Try this:

For a = 1 to 9
if a = 1 then
printer.print "low"
printer.enddoc
next a
if a >= 9 then
Printer.print "High"
Printer.enddoc
end if


[fish] No Dolphins were harmed in the posting of this message... Dolphin Friendly Tuna!
 
After your loop, a = 10, not 9, so the "high" never prints...

The loop actually increments a one more time when it hit's the next a for the last time, but the loop is complete so it no longer executes, even though it incremented the variable once more...



[fish] No Dolphins were harmed in the posting of this message... Dolphin Friendly Tuna!
 
If you want the prints on the same page, better to use the .enddoc method after all the print's...

For a = 1 to 9
if a = 1 then printer.print "Low"
next a
if a >=9 then printer.print "High"
printer.enddoc

[fish] No Dolphins were harmed in the posting of this message... Dolphin Friendly Tuna!
 
I have a different view as to the problem, I thought the issue was missing lines of print and as a test a listing of the code was printed that should look like this

FOR a = 1 TO 9
IF a = 1 THEN PRINTER.PRINT "low"
IF a = 9 THEN PRINTER.PRINT "high"
NEXT a

But line 3 was blank

If its a coding issue why does it work at home, I was thinking along the lines of printer drivers or VB service packs.
 
Absolutely... I wanted to keep the structure as posted, but it's simply cleaner this way. Do you not see a need to use .enddoc though SOE?


[fish] No Dolphins were harmed in the posting of this message... Dolphin Friendly Tuna!
 
I agree, you need .enddoc at the appropriate place, otherwise nothing would be printed until the application ends.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top