[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 172
  • Last Modified:

How to print n save in vb using windows messange box

Now i am using common dialog box to print n save my project in vb, however it  can't work, so how can i save n print in vb just like what i do in microsoft. Pls send me your souce code.
0
yefam
Asked:
yefam
  • 2
  • 2
1 Solution
 
tirupur_selvaCommented:
Use the printer object.
Example:
 Printer.print "yefam"
Im sorry that I cannot send the complete code, coz it has to be kept confidential. Anyhow..if you have further doubts regarding using the printer object I'll guide you.

Regs
Selva
0
 
yefamAuthor Commented:
Dear sir,
         I already set up a printer message box as what we can see in windows by , however the message box can't work. How can i activate it? ( what i want is not only to print but select something first such as paper size before print.)
0
 
tirupur_selvaCommented:
Did you try 'commondialog1.showprinter?
If you are using an MDI form, you can call the above by putting it in a menu click event or if you want it in every form, you can put it in a command button's click event. In that you could get everything what you ask for(like setting the paper size(eg. A4, lettersize, legal, Fanfold, custom etc), you can even set the landscape and portrait modes.

Hope this is what you were asking for?
0
 
chunyanCommented:
i already try it . it show the messange box but can not run. Why?
0
 
yefamAuthor Commented:
Dear sir,
     my source code as below:


Private Sub mnPrint_Click()
Dim ocancel As Boolean
Dim ncopy As Integer
On Error GoTo errorhandler
ocancel = False
CommonDialog1.Flags = &H20& Or &H10 Or &H4& Or &H8&
CommonDialog1.CancelError = True
CommonDialog1.PrinterDefault = True
CommonDialog1.Copies = 1
CommonDialog1.ShowPrinter
If ocancel = False Then
    For ncopy = 1 To CommonDialog1.Copies
    Next ncopy
End If
Exit Sub
errorhandler:
    If Err.Number = cdlCancel Then
        ocancel = True
        Resume Next
    End If
End Sub


     Can you tell me what is the problem? Thank you.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now