|
#1
|
|||
|
|||
|
help printing
I know I have had several New Threads here lately that is because I think no one understands what I am trying to do. I am trying to get the printout on a peice of paper to look like this:
1. example KF 123 O45 1975 and not like this: 2. example KF 123 O45 1975 In one of the threads someone had sent me some code which I have listed below when I try it, it comes out looking like example 2.: Code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Replica_of_db181DataSet.CARD_CATALOG' table. You can move, or remove it, as needed.
Me.CARD_CATALOGTableAdapter.Fill(Me.Replica_of_db181DataSet.CARD_CATALOG)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
PrintDocument1.Print()
End Sub
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim fnt As New Font("Arial", 10, FontStyle.Regular, GraphicsUnit.Point)
e.Graphics.DrawString(TextBox1.Text, fnt, Brushes.Black, 0, 0)
TextBox1.Multiline = True
e.HasMorePages = False
End Sub
End Class
|
|
#2
|
|||
|
|||
|
help printing
Could you tell me if there is some other forum on the internet that would work better for me to get my problem looked at and answered by someone.
|
|
#3
|
|||
|
|||
|
This May Help
I am no expert in printing, which can be pretty clumsy in Visual Studio, but I'll make a suggestion. Instead of hoping your very narrow multi-line text box will be rendered accurately by the print routine, why don't you force the issue by inserting carriage returns and line feeds between each of the parts.
Try the following: Code:
'In your current Button1_Click,
'assign the content of TextBox1.Text to OneLineText
Dim OneLineText As String = TextBox1.Text
Dim Parts() As String
Dim TextWith_CR_and_LFs As String = ""
'add Cr&Lf to each part
Parts = OneLineText.Split(" ")
For Each Part In Parts
TextWith_CR_and_LFs &= Part & vbCrLf
Next
'assign the split-up text back to TextBox1.Text
TextBox1.Text = TextWith_CR_and_LFs
'Then call PrintDocument1.Print()
Benn Gibson |
|
#4
|
|||
|
|||
|
help printing
Thank you for the post but I did not think anyone would post and so I have not checked back until today. I did try the code you gave to me but it did not work it printed a blank page. and on the screen inside of the textbox it shows the return charecters what could be wrong.
|
|
#5
|
|||
|
|||
|
What do you mean "on the screen inside of the textbox it shows the return charecters"? I don't know what "return characters" are.
Are you trying to say that the screen shows accurately what you hope it would, but nothing gets printed? Benn Gibson |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to enable the printing queue when the printer is off? | Newton | VB Classic | 2 | 11-11-2008 10:46 AM |
| WebBrowser Control: Problem with Silent Printing | vb_programmer | VB Classic | 0 | 10-20-2006 04:35 PM |
| How to enable the printing queue when the printer is off? | Newton | VB Classic | 0 | 01-25-2002 05:59 AM |
| ASP questions - mainly printing | dandy | ASP.NET | 0 | 08-27-2001 05:00 PM |