Wrox Programmer Forums
|
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 16th, 2004, 12:52 AM
Authorized User
 
Join Date: Aug 2004
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default Stupid problem

Hi,

 Today, i got stupid problem.
I am generating the text file from VB

while not rs.eof
strOP=strOP & rs(0) & rs(1) &...& vbcrlf & vbcrlf & vbcrlf
rs.movenext
wend

Using filesystemobject, i am creating a text file with the contents strOP.

If i go to DOS prompt and issue this command c:\mydata.txt > prn

There is no equal spacing b/w lines. But yesterday i was printed correct.
I tried with open "lpt1" for output as #1 also. The same problem.

So, i tried a simple text file from DOS prompt (c:\edit test.txt) and added 8 lines with equal line spacing (as i have from VB, the same spacing - 2lines) and print using type test.txt > prn
its printing in exact alignment.
How come it is like this? Both the way i am using DOS. But on contains data from VB and the other is at DOS.


Pls reply me

 
Old December 16th, 2004, 02:39 AM
Authorized User
 
Join Date: Aug 2004
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

  When i measure the space b/w lines on the printout

1. Text file generated from VB

   Spacing is varying from 14mm to 16 mm. And some lines with 10mm only.

2. Text file created directly at DOS prompt(edit test.txt)

  Spacing is 10mm only.(Here my printed output is correct)

Both the ways, i opened text files in DOS mode and find the lines gap, its 2 lines only. (Coz i inserted vbcrlf & vbcrlf & vbcrlf. First one is for breaking the line)
And in the direct file, i inserted 2 enters.
Both files looks same when u see.
But printing makes difference.
Why? Whats wrong with me?


 
Old December 16th, 2004, 12:45 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Do you have the ability to view these files in an environment that tells you the value of each byte in the file?
(MS C++ environment will let you do this. A program that does this is usually called a 'hex editor'.)

I would first of all want to see if there were characters at the beginning or end of the file that might be causing the printer to handle the files differently.
Next, I would want to see if the non-printing characters used to signify the ends of lines are exactly the same.
(You can use VB file handling--open, get(), etc--to read the files into byte arrays and examine them that way, though it's a bit of work to do so...)





Similar Threads
Thread Thread Starter Forum Replies Last Post
really stupid problem with anchor tags thenoseknows ASP.NET 2.0 Basics 3 August 31st, 2006 09:34 AM
Stupid Problem with Example alanmdunsmuir BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 1 May 31st, 2006 08:55 AM
stupid question j_pres44 Beginning PHP 4 December 13th, 2004 05:06 AM
Stupid Problem... on comparing variables! Varg_88 Classic ASP Basics 1 December 11th, 2004 06:00 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.