What is the print command in VB6?

Posted on 2003-02-22
Medium Priority
Last Modified: 2008-01-09
I just started programming with VB6 and I've made some basic applications so far.  I was wondering, what is the most basic command to print the screan of an application?  Is there some type of print screen command I can assign to a button?  Thanks a lot!
Question by:echobravo316
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

Frog357 earned 200 total points
ID: 8001402
PrintForm Method

Sends a bit-by-bit image of a Form object to the printer.

PrintForm prints all visible objects andbitmaps of the Form object.

If you wanted to use this in a command button named Command1, the code would look like so:

Private Sub Command1_Click()
End Sub


Expert Comment

ID: 8001411
How about this.

Private sub Command1_Click()
Call Form1.PrintForm
end sub

Author Comment

ID: 8001465
Thankyou very much!  Worked like a charm.

Expert Comment

ID: 8001467
you can type:

? "Hello World!"

in your main form

private sub Form_Load()
  ? "Hello World!"
end sub

? = print, so when you press enter it will just change to print

private sub Form_Load()
  print "Hello World!"
end sub

It will just print straight out onto your main form in the top left corner.

alternatively you can print to the debug screen with:

private sub Form_Load()
  debug.print "Hello World!"
end sub

Best way of displaying something quickly and easily is to create a new text box on the screen, then print out to that (if you want more than 1 line be sure to enable multiline in the properties)

private sub Form_Load()
  Text1.Text = "Hello World!" & vbCrLf & "Second Line!"
end sub

Hope that helps you.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month11 days, 16 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question