Advertisement
2_2002-2004 VB function enhancement #116414

Printing and spaces

The purpose of this article is to introduce the new user to the art of printing quickly and simply.

AI

สรุปโดย AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

ซอร์สโค้ด
original-source
Many people believe VB to be a major pain as like other programming languages because they are too tech. So are most things if you think about it for long enough and you're new to it. Anyway, here is a simple way to print in visual basic and also introduce you to a neat printing method. I take no credit for this because it is an article I found elsewhere.

Create a new standard.exe

create two labels

do what you want with the labels. The name and the captions don't matter.

Now, create a button and change its caption to: &Print and its name to cmdPrint.

In the button's code window, type the following code:

Printer.Print label1.caption; spc(30); label2.caption

The above code must all be on 1 line.

Good. You've mastered a simple printing method.

You can, of course, manipulate the printing methods above to print documents in a snazzy manner. 

Before End Sub, type the following code:

Printer.Enddoc

This ensures the print job ends as you finish printing. Nice one!
ความคิดเห็นดั้งเดิม (3)
กู้คืนจาก Wayback Machine