CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: printer help

  1. #1
    Join Date
    Apr 2001
    Location
    Chicago, IL
    Posts
    27

    printer help

    Using this code does anyone know what code I need to add so that the common dialog combo box appears so that I can select either "ok" or "cancel". Thank you.

    Private Sub mnuPrint_Click()
    Dim Item As Integer
    Dim ErrHndlr As Integer
    On Error GoTo ErrHndlr
    cdlOne.CancelError = True
    cdlOne.ShowPrinter
    On Error GoTo 0

    ' Prints the contents of the lstShopping list box.

    For Item = 0 To lstShopping.ListCount - 1
    Printer.Print lstShopping.List(Item)
    Next
    Printer.EndDoc
    Exit Sub
    ErrHndlr:

    End Sub


    Archie Kantzavelos

  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: printer help

    I just tried it it works

    Private Sub Command1_Click()
    On Error Resume Next
    List1.AddItem "c:\zip\junk.txt" ' or set the .Text property to some string value
    List1.ListIndex = 0

    With CommonDialog1
    .CancelError = True
    .Flags = cdlPDReturnDC + cdlPDHidePrintToFile + cdlPDNoPageNums + cdlPDNoSelection + cdlPDNoWarning
    .ShowPrinter
    End With
    If (Err.Number <> cdlCancel) Then
    Printer.Print List1.Text
    Printer.EndDoc
    End If
    On Error GoTo 0
    End Sub

    I did not do Loop for this test

    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

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

Featured