|
-
Oct 27th, 2005, 06:59 PM
#1
Thread Starter
Lively Member
[RESOLVED] commondialog printer help plz
Hi,
When I use the commondialog for selecting the printer to print to i.e.
VB Code:
Private Sub Command1_Click()
CommonDialog1.ShowPrinter
Me.PrintForm
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 
-
Oct 27th, 2005, 07:07 PM
#2
Re: commondialog printer help plz
-
Oct 27th, 2005, 08:11 PM
#3
Thread Starter
Lively Member
Re: commondialog printer help plz
Roger that dglienna thanks! 
I use to have some code that was simular to this;
VB Code:
'Load up the Printers installed
Dim i As Integer ' For printer collection
For i = 0 To Printers.Count - 1 'Gets the printers installed on the sytem
cboPrinters.AddItem Replace(Printers(i).DeviceName & "[" & Printers(i).DriverName & "]", "[winspool]", "")
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 
-
Oct 27th, 2005, 08:17 PM
#4
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.
-
Oct 27th, 2005, 09:39 PM
#5
Thread Starter
Lively Member
Re: commondialog printer help plz
 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:
cboPrinters.Clear
'Load up the Printers installed
Dim i As Integer ' For printer collection
For i = 0 To Printers.Count - 1 'Gets the printers installed on the sytem
cboPrinters.AddItem Replace(Printers(i).DeviceName & "[" & Printers(i).DriverName & "]", "[winspool]", "")
Next
cboPrinters.List(0) = Printer.DeviceName
Just an infant in VB years 
-
Oct 27th, 2005, 10:23 PM
#6
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.
-
Oct 28th, 2005, 12:47 AM
#7
Thread Starter
Lively Member
Re: commondialog printer help plz
I finaly got it!
VB Code:
'Load up the Printers installed
Dim i As Integer ' For printer collection
For i = 0 To Printers.Count - 1 'Gets the printers installed on the sytem
cboPrinters.AddItem Replace(Printers(i).DeviceName & "[" & Printers(i).DriverName & "]", "[winspool]", "")
Next
cboPrinters.Text = Printer.DeviceName
Just an infant in VB years 
-
Oct 28th, 2005, 01:56 AM
#8
Re: commondialog printer help plz
That way it is in there twice, but it works. A listbox doesn't have the extra line.
-
Oct 28th, 2005, 07:58 AM
#9
Thread Starter
Lively Member
-
Oct 28th, 2005, 08:09 AM
#10
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.
-
Oct 28th, 2005, 08:11 AM
#11
Thread Starter
Lively Member
Re: [RESOLVED] commondialog printer help plz
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|