Results 1 to 11 of 11

Thread: [RESOLVED] commondialog printer help plz

  1. #1

    Thread Starter
    Lively Member jkmcgrath's Avatar
    Join Date
    Dec 2004
    Posts
    79

    Resolved [RESOLVED] commondialog printer help plz

    Hi,

    When I use the commondialog for selecting the printer to print to i.e.

    VB Code:
    1. Private Sub Command1_Click()
    2. CommonDialog1.ShowPrinter
    3. Me.PrintForm
    4. End Sub

    THere is a delay that depends on the size of the form. THe screen doesnt re-draw until it was made it to the printer.

    Is there anyway to remove that delay so that as soon as you select "Print" in the commondialog it returns back to the program quickly?

    Using the printer object is lighting quick!

    Thanks
    John
    Just an infant in VB years

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: commondialog printer help plz


  3. #3

    Thread Starter
    Lively Member jkmcgrath's Avatar
    Join Date
    Dec 2004
    Posts
    79

    Re: commondialog printer help plz

    Roger that dglienna thanks!

    I use to have some code that was simular to this;
    VB Code:
    1. 'Load up the Printers installed
    2.     Dim i As Integer ' For printer collection
    3.     For i = 0 To Printers.Count - 1 'Gets the printers installed on the sytem
    4.         cboPrinters.AddItem Replace(Printers(i).DeviceName & "[" & Printers(i).DriverName & "]", "[winspool]", "")
    5.     Next
    But it had the default printer at the top of the list, BUT I have lost it

    Anyone know how to do that?
    Just an infant in VB years

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: commondialog printer help plz

    Just set the .TopIndex to the current printer. It won't matter if there are others above it. It will be the first one in the list that is seen.

  5. #5

    Thread Starter
    Lively Member jkmcgrath's Avatar
    Join Date
    Dec 2004
    Posts
    79

    Re: commondialog printer help plz

    Quote Originally Posted by dglienna
    Just set the .TopIndex to the current printer. It won't matter if there are others above it. It will be the first one in the list that is seen.
    I cannot get rid of a blank entry on form load in the combo box. however the default printer is the the first on the list when you click on the down arrow.

    Any idea why it loads a blank at top?

    VB Code:
    1. cboPrinters.Clear
    2.     'Load up the Printers installed
    3.     Dim i As Integer ' For printer collection
    4.     For i = 0 To Printers.Count - 1 'Gets the printers installed on the sytem
    5.         cboPrinters.AddItem Replace(Printers(i).DeviceName & "[" & Printers(i).DriverName & "]", "[winspool]", "")
    6.     Next
    7.     cboPrinters.List(0) = Printer.DeviceName
    Just an infant in VB years

  6. #6
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: commondialog printer help plz

    That's the nature of a combobox. It combines a textbox and a listbox.
    You probably want to use a Listbox instead.

  7. #7

    Thread Starter
    Lively Member jkmcgrath's Avatar
    Join Date
    Dec 2004
    Posts
    79

    Re: commondialog printer help plz

    I finaly got it!

    VB Code:
    1. 'Load up the Printers installed
    2.     Dim i As Integer ' For printer collection
    3.     For i = 0 To Printers.Count - 1 'Gets the printers installed on the sytem
    4.         cboPrinters.AddItem Replace(Printers(i).DeviceName & "[" & Printers(i).DriverName & "]", "[winspool]", "")
    5.     Next
    6.     cboPrinters.Text = Printer.DeviceName
    Just an infant in VB years

  8. #8
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: commondialog printer help plz

    That way it is in there twice, but it works. A listbox doesn't have the extra line.

  9. #9

    Thread Starter
    Lively Member jkmcgrath's Avatar
    Join Date
    Dec 2004
    Posts
    79

    Resolved RESOLVED Re: commondialog printer help plz

    I made the combobox style a listbox so it only appears once. You cannot type in the box with it like that so it works like a listbox.

    On my original issue, I didnt have the form set to autodraw
    Just an infant in VB years

  10. #10
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: commondialog printer help plz

    If this issue is resolved, then the first post needs the green checkmark the and resolved added to the title.

    Neither will show up if placed on any post within the thread except the first.

    A quick way to show a thread is resolved is to pull down the Thread Tools menu and click Mark Thread Resolved.

  11. #11

    Thread Starter
    Lively Member jkmcgrath's Avatar
    Join Date
    Dec 2004
    Posts
    79

    Re: [RESOLVED] commondialog printer help plz

    Roger that, Sorry hack
    Just an infant in VB years

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