Results 1 to 8 of 8

Thread: Simple Line Print

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949

    Simple Line Print

    Hi,

    I've browsed through all the threads I can find without success.

    Is there a .NET equivalent of the VB6 code

    VB Code:
    1. Printer.Print "This is a test"
    2. Printer.EndDoc
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  2. #2
    Frenzied Member <ABX's Avatar
    Join Date
    Jul 2002
    Location
    Canada eh...
    Posts
    1,622
    Simple Printing Sample:

    [Attached]
    Tips:
    • Google is your friend! Search before posting!
    • Name your thread appropriately... "I Need Help" doesn't cut it!
    • Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
    • Allways Include the Name and Line of the Exception (if one is occuring!)
    • If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)


    If you think I was helpful, rate my post
    IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi ABX,

    "Simple Printing Sample:"

    I guess your Idea of "simple printing" differs radically from mine


    This is enough to send me back to VB6!

    Does this mean there is no .NET equivalent of:

    VB Code:
    1. Printer.Print "This is a test"
    2. Printer.EndDoc
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Unforuntately printing in .NET sucks. The next version has a MUCH better printing model, but for now this is about the closest thing:
    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         Dim pdoc As New Printing.PrintDocument
    3.         AddHandler pdoc.PrintPage, AddressOf DoPrintPage
    4.         pdoc.Print()
    5.         RemoveHandler pdoc.PrintPage, AddressOf DoPrintPage
    6.     End Sub
    7.  
    8.     Private Sub DoPrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs)
    9.         e.Graphics.DrawString("This is a test!", Me.Font, New SolidBrush(Color.Black), 10, 10)
    10.     End Sub

    Basically you draw what you want to print in the PrintPage event of a PrintDocument.

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi Edneeis,

    That's much easier

    How can I prevent the page ejecting from the printer until I want it to? i.e. Allow printing several lines.


    Many thanks,
    Last edited by taxes; Mar 22nd, 2004 at 05:48 AM.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  6. #6
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682
    Remember this:

    open "LPT1:" for output as #1
    print #1, "Hello Printer"
    close #1

    Happy days from a bygone era of dot matrix printers.
    I don't live here any more.

  7. #7

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi,

    "open "LPT1:" for output as #1
    print #1, "Hello Printer"
    close #1
    "


    Or even earlier

    Echo:
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  8. #8
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    I don't think you can. You'd have to do all your processing either before or during the event but I think it still calls EndDoc at the end of the PrintPage event.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width