Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 Printer Format Sting

Author  Topic 

amitkumarmadhukar
Starting Member

45 Posts

Posted - 2004-08-06 : 05:20:24
hello guys

i used code for printing looks like


Do While Not .EOF
Printer.Print
Space(15); "" + Name + ""; Space(5); "" + Amount+""
.move next
Loop
and may be the value of in 3 loops are
[Amit] [2522.52]
[Sumit] [2523.53]
[Raja Ram] [5223.63]


and the output over paper i receive is

Amit-----------------2552.52
Sumit-----------------2523.53
Raja Ram-----------------5223.63


i mis ordered allignement because Amit if of 4 length, sumit is of 5 length and Raja Ram is or 8 length


and i want to the output on paper as
Amit-----------------------2552.52
Sumit----------------------2523.53
Raja Ram-------------------5253.63



Can u suggest the right printer format string instead of

Printer.Print "Space(15); "" + Name + ""; Space(5); "" + Amount+"" "


amit kumar madhukar

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2004-08-08 : 19:02:43
Try declaring your strings as fixed-length. Then they will be automatically padded to the correct length for printing.
Or you could write a function to pad a string to a given length:
newStr = str & Space(newLength - len(str))

Or you could set the column positioning using the VB CurrentX and CurrentY properties. This is probably the most reliable, as it allows also for non-fixed width fonts.

Tim
Go to Top of Page

amitkumarmadhukar
Starting Member

45 Posts

Posted - 2004-08-09 : 14:27:21
Hello, Timmy
Thanks for taking interest into my question.
Thanks for Advice.

But Sorry to inform that i solved my problem already. and in that process Dr. Mr JSmith,USA and One Person From UAE help me to get at the point of solution.
however this is not the matter of Fixed Length,
I think that u know better in bussiness world alwayas there is no fixed length vairable, Amounts, Description, Number vary time to time so we can use fixed length variables.

and u talk about the function to pad the length of varible then my dear that was my question not my solution.

and u also talk about the Current X and Current Y feature of Printer. have u any idea about the length of coding to control Current X and Curren Y if you have to Print 100 of pages with thousand of word.

so now i think u learned that how far u actually from the even question.




amit kumar madhukar
Go to Top of Page

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2004-08-09 : 19:39:01
Just trying to help. I won't in future if that's your attitude.....

Go to Top of Page
   

- Advertisement -