Print method in VB6.0

1.Print method

  The Print method can be used for objects such as forms, picture boxes, immediate windows, and printers. Used to display the value of text characters and expressions.

expression:


  Object.Print   Object is the name of the object. The object can be a form (Form), an immediate window (Debug), a picture box (PictureBox), a printer (Printer), etc.
  You can use "?" to replace the
  expression table in the Print keyword. It is composed of several expressions. Separator comma (,), semicolon (:) or TAb, SPc functions, etc. can be used between each expression. These can be mixed.

2. Functions related to the Print method

TAb

 &emsp: Tab function and Print method are used together to position the output cursor, the format is Tab(n). The function of the Tab function is to calculate the value of the numeric expression N, see the code for details:


    Private Sub Form_Click()  
    Print Tab(10); "班级"; Tab(20); "姓名"; Tab(30); "性别"
    End Sub

  Note: n represents the column number of the next output position. When the current display position exceeds n, it will automatically move down one line (theory). But my own test did not show up, that is, when Tab(30) was replaced with Tab(300), the gender did not show up when running the program. Each TAb function corresponds to an output item.

Spc

  In the Print method or Print# statement, use the Spc function to skip N spaces, the format is: Spc(n)


    Private Sub Form_Click()
    Print Spc(10); "班级"; Tab(20); "姓名"; Tab(30); "性别"
    Print Spc(20); "班级"; Tab(20); "姓名"; Tab(30); "性别"
    End Sub

Guess you like

Origin blog.csdn.net/yue008/article/details/80601908