printing in vb6
im trying to print a form that have some lists
containing data and the data in list is more than the hieght if the list. so i m not getting
the printout of full data contained in the list.
Peripheral
im trying to print a form that have some lists
containing data and the data in list is more than the hieght if the list. so i m not getting
the printout of full data contained in the list.
by shahvez.alam Accepted solution
by john.a.wills Accepted solution
by gwl Accepted solution
You will not be able to print using form printing. Rather use PRINTER.PRINT xxx where xxx is data, could be an item from the list or anything else. For example to print the contents of a list just create a for next loop and print each item and then proceed to the next item. With PRINTER.PRINT you can design where on the page you print using the various properties of the PRINTER object:
Printer.Font.name = "Arial"
Printer.Font.bold = true
Printer.Font.italic = true
Printer.Font.underline = false
Printer.Font.SIZE = 14
Printer.Font.charset = 128
printer.currentx=3.4
printer.currenty=2.5
printer.print="Hello World"
by rnd Accepted solution
Hello friends,
I have some strange problem. While Debugging ,i can get correct printout(text & graph).But when i create .exe or setup, It prints from reverse direction i.e. text on left get printed on right.
Please help me out.
Thanking you in advance.
Regards,
Shitalkumar
by atklinger Accepted solution
Hi there.
First at all, I was trying to understand the question.
If you want to print the form with the data included, the fisrt option it is to use Ctrl+Print Screen. You get All in your screen. The buffer is copied to your clipboard and you can paste this to a program like Paint or other and after that you can print it.
The other thing I normally do, it is to print all the data on the ListBox Control and I do use the procedure below.
To get that, you must have a CommonDialog Control in your form and of course a ListBox Control and also a CommandButton. The name of the Controls must be changed to those in your program or to your preference.
Here is the Code:
'------------------
Private Sub cmdPrint_Click()
' Stablishing the CommomDialog Control
With cdlKlinger
.CancelError = False
On Error GoTo ErrorHandler
If (Err.Number = cdlCancel) Or (Err.Number = 32755) Or (cdlCancel = True) Then
' The User Canceled. Do nothing.
GoTo ErrorHandler
Exit Sub
Else
.Flags = (cdlPDReturnDC = True) And (cdlPDSelection = True) And _
(cdlPDHidePrintToFile = True) And _
(cdlPDDisablePrintToFile = True) And _
(cdlPDSelection = True) And _
(cdlPDAllPages = True)
.ShowPrinter
Printer.Orientation = .Orientation
' Printing in Printer
Printer.Font.Bold = True
Printer.Print vbTab & "Allowable Stress Design" & vbCrLf
Printer.Print vbTab & Me.Caption & vbCrLf
Printer.Print vbTab & Format(Now, " mmm dd, yyyy (dddd)" & vbTab & "hh:mm:ss") & vbCrLf
Printer.Font.Bold = False
Printer.Print
Printer.Print
With lstCase01
For i = 0 To .ListCount
Printer.Print vbTab & .List(.ListIndex + i)
Next i
End With
Printer.NewPage
Printer.EndDoc
Printer.KillDoc
End If
End With
Exit Sub
ErrorHandler:
MsgBox "Error: " & Format$(Err.Number) & _
"Selecting Printer:" & Printer.DeviceName & vbCrLf & vbCrLf & _
Err.Description & vbCrLf & vbCrLf & _
Err.Source, vbCritical, Me.Caption
Exit Sub
End Sub
'--------------------------
I hope that these ideas can help you.
Alberto
This discussion is closed to new replies.
Sort by Trending