Re: VB Printer Dialog Problem (VB6)



Okay, I'll try to make it clear.

What I print is an orderticket to rent products.
But that order ticket is more like a contract, so many
conditions must be print on that orderticket. It also
is possible to print it in 2 different languages, dutch and
french. So this means that some of the text will be larger or
smaller, deppends on the selected language.

Most of the text that will be printed is set at design time,
like conditions. But somewhere in the middle of the text
there's also data printed of the selected customer, such like,
Name, Company, Address ... Because the data of the customer
is always different, there will be always a different text width and
also a different text height, and that's because I use a WordWrap
function that I've made to measures the text width, and breack
the words if the text width is larger than the given width for one
line.

Example: (Customers is a 2 dimensional array)
In my bas module:
Private Type CustomersType
Name As String
Company As String
Streetname_and_number As String
End Type
Public Customers() As CustomersType
Public Customers_EOF As Integer
---
In the form, for example record of customer = 56
Text width for one line is 187mm:
Dim CustomerStr As String
With Customers(56)
CustomerStr = .Name + ", " + .Company + ", " _
+ .Streetname_and_number
End With
With Printer
.Print WordWrap("This is an example with " _
+ "customerdata wich is, " + CustomerStr _
+ ". After that the text continues.", 187)
End With
---

Another thing I use is a table with an overview of all
products to rent. Such like Discription, Price/Piece, Qty,
Total. The height of that table depends on how many products
the user has added to the orderticket. The user can also add free text
inside that table, and the lenght is unlimited. So I use also my
WordWrap function for the discription inside the table. To draw the
table
I use the Printer.Line statement to draw the rectangles inside that
table, wich I've learned now thanks to this topic to do it right.

Before the next product will print inside the table I first check if
the
text height for the discription is not to large to print it on the same
page.
I set the limit of the bottom margin of the page to 275mm.:
Syntax: With Printer

If .CurrentY + .TextHeight(WordWrap(DiscriptionStr, 127)) > 275 Then
.NewPage
'
' Draw the table again on the next page and resume printing with
' the products.
End if

And this goes on over the whole order ticket. Always checking if the
text height or the height of rectangles is not to large to print it on
the same page. So that's why I'll never know how many pages there
will be print.

I hope that I now gave enough information to explain what I'm printing.
Otherwise, shame on me.

Andy

.



Relevant Pages

  • Delegate question
    ... customer, and now I want to set a delegate up to Notify of any new ... was simple because I just instantiate the Delegate after i create the ... Private Sub init() ... Dim idx As String ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Want to Protect my Software - Recommendations?
    ... license keys. ...  If the license contains personal information, the customer ... One more important thing is that Microsoft decided not to use ... Basically you need to then have your software generate a unique string ...
    (sci.crypt)
  • Re: Multi-tier ASP.net web application
    ... I have a table "Customer" in the database. ... Dim password As String ... Public Sub New ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Multi-tier ASP.net web application
    ... Usually in Java applications, I created objects out of the database, ... I have a table "Customer" in the database. ... Dim password As String ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Query on dbase files with access and VBA
    ... FROM Customer AS C INNER JOIN Poub1 ... So the VBA string concat should look like this: ... > SELECT P.* FROM Customer AS C INNER JOIN Poub IN "[dBase ... Each dbase file>>>is named PoubX where X is 1 to 99. ...
    (microsoft.public.access.queries)