Top DevX Stories
Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Search the forums:
  #1  
Old 10-27-2009, 07:55 PM
COMPCAD COMPCAD is offline
Registered User
 
Join Date: Nov 2004
Posts: 22
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
I want the code to print out the data to look like example 1. I hope there is someone out there that can help me
Reply With Quote
  #2  
Old 10-28-2009, 03:13 PM
COMPCAD COMPCAD is offline
Registered User
 
Join Date: Nov 2004
Posts: 22
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.
Reply With Quote
  #3  
Old 10-29-2009, 01:50 PM
bgibson bgibson is offline
Registered User
 
Join Date: Nov 2004
Posts: 32
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()
Good luck!

Benn Gibson
Reply With Quote
  #4  
Old 11-10-2009, 01:00 AM
COMPCAD COMPCAD is offline
Registered User
 
Join Date: Nov 2004
Posts: 22
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.
Reply With Quote
  #5  
Old 11-10-2009, 01:10 PM
bgibson bgibson is offline
Registered User
 
Join Date: Nov 2004
Posts: 32
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
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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


All times are GMT -4. The time now is 11:35 PM.


Sponsored Links



Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.