[VB6.0] common VB terms/internal functions

Source: Internet
Author: User
Tags mathematical functions rounds
Terms

Project: a collection of files created by a user. This collection includes your Windows applications.

Control: a tool in a toolbox window that allows you to place a user on a form.

Code: The name of a programming statement.

Pixel: A graphical element that represents the smallest addressable graphical point on the monitor.

Global variables: variables that can be used within the entire module or the entire application.

Function: a routine that accepts zero, one, or more parameters and returns a result based on these parameters.

Infinite Loop: an endless loop.

Syntax error: A syntax error occurs when a command is misspelled or incorrect syntax is used.

Message Box: a dialog box that is displayed to provide information to users.

Loop: a set of repeated program instruction sets.

Assignment Statement: A program statement used to assign values to controls, variables, or other objects.

Structured Program Design (structured programming): A program design method that divides a long program into several small processes for as detailed as possible.

Calling procedure: a process that triggers execution of other processes.

Called procedure: a process called by other processes.

By Reference: a method that passes values and allows them to be modified by the call process. It is also called by address ).

 

By value: it is a method that transfers values and protects the data transmitted during the call process. Therefore, the called process cannot change this data.

1 type Conversion Function

1. INT (x): returns the maximum integer not greater than X of the independent variable.
2. Fix (x): remove the fractional part of a floating point number and retain its integer part.
3. HEX $ (x): converts a decimal number to a hexadecimal number.
4. Oct $ (x): converts a decimal number to an octal number.
5. ASC (x $): returns the ASCII character of the first character in string x $.
6. CHR $ (x): converts the value of X to an ASCII character.
7. Str $ (x): converts the value of X into a string.
8. CINT (x): rounds the fractional part of X to an integer.
9. ccur (x): converts the value of X to a currency value. The decimal part can be rounded to a maximum of four digits.
10. cdbl (x): converts x values to Double Precision values.
11. clng (x): rounds the fractional part of X to a long integer.
12. csng (x): converts X to a single precision number.
13. CVaR (x): converts X to a variant type value.
14. varptr (VAR): Get the pointer of the variable VAR

2. mathematical functions

1. Sin (x): returns the sine of the independent variable X.
2. Cos (x): returns the cosine of the independent variable X.
3. Tan (x): returns the tangent of the independent variable X.
4. ATN (x): returns the arc tangent value of the independent variable X.
5. Abs (x): returns the absolute value of the independent variable X.
6. SGN (x): returns the symbol of the independent variable X, that is, when X is negative,-1 is returned; when X is 0
0; when X is positive, 1 is returned.
7. sqr (x): returns the square root of X, which must be greater than or equal to 0.
8. exp (x): returns the base-E, X-exponent value of E, that is, the power X of E.

2. Date and Time Functions

1. Day (now): returns the current date
2. weekday (now): returns the current week.
3. Month (now): returns the current month.
4. Year (now): returns the current year.
5. Hour (now): returns the hour (0 ~ 23)
6. Minute (now): returns the score (0 ~ 59)
7. Second (now): returns the second (0 ~ 59)

2. Random Number Function

1. RND [(x)]: generates a 0 ~ Single-precision random number between 1
2. Randomize: The RND [(x)] function is the same as above, but it is better.

2. String Functions

1. ltrim $ (string): removes the white space on the left of the string.
2. rtrim $ (string): removes the white space on the right of the string
3. left $ (string, n): n characters at the left of the string.
4. Right $ (string, n): n characters on the right of the string
5. Mid $ (string, P, n): n characters of the string starting from position P
6. Len (string): test the string length.
7. String $ (n, string): returns a string consisting of n characters.
8. Space $ (n): returns n spaces.
9. instr (string 1, string 2): search string 2 in string 1
10. ucase $ (string): converts lowercase letters to uppercase letters.
11. lcase $ (string): converts uppercase letters to lowercase letters.

2. Form Input and Output Functions

1. Print (string): the output string in the form. You can use "&" to connect the variables and then output them.
2. tab (n): move the cursor to the starting position of N in the row.
3. SPC (n): Skips n spaces.
4. CLS: Clear the display content in the current form
5. Move X in the upper left corner, Y in the upper left corner, width, and height: Move a form or control.
6. inputbox (prompt ,...) : Jumps out of a data input window. The returned value is the input value of the window.
7. msgbox (MSG, [type]…) : A Prompt window is displayed.

2. file operation functions

1. Open File name [for mode] [Access access type] [locked] as [#] File number [Len = record length]
Function: allocates a buffer for the input and output of a file and determines the access mode used by the buffer.
Note:
1) mode: Specifies the input/output mode of the file. Optional. The default value is random, which can be the following values:
A. Output: Specify the ordered output mode to overwrite the original content.
B. Input: Specify the sequential input mode.
C. append: Specify the sequence output mode and Append content to the file before the end.
D. Random: Specifies the random access mode, which is also the default mode. In the random mode, if there is no access clause, VB will open the file in the following order when executing the open statement: read/write, read-only, write-only
E. Specify the binary file. In this way, you can use get and put statements to read and write information at any byte location in the file. In binary mode, if there is no access clause, the type of the opened file is the same as that in random mode.
2) access type: After keyword access, it is used to specify the file access type. It can be one of the following types
A. Read: open a read-only file
B. Write: Open the write-only file
C. Read Write: Open the read/write file. This type is only valid for random files, binary files, and files opened in append mode.
3) Locking: This clause is only used by multiple users or in multi-user or multi-user environments. It is used to restrict other users or other processes from performing read/write operations on the open. Lock types include:
A. Default: If the lock type is not specified, the current process can open the file for read and write multiple times. During the file opening process, other processes cannot perform read and write operations on the file.
B. Lock shared: Any process on any machine can read and write the file.
C. Lock read: other processes are not allowed to read the file. This lock is allowed only when no other read access type process accesses the file.
D. Lock write: other processes are not allowed to write this file. This lock is allowed only when no other write access type process accesses the file.
E. Lock read write: other processes are not allowed to read and write this file.
If the lock clause is not used, the default value is lock read write.
4) file number: You can specify a file number from 1 ~ An integer between 511, as long as the file number is not used, it is legal; after opening the file, you can use this file number for read and write operations.
5) record length: it is an integer expression. When this parameter is selected, set the record length for the random access file. For files opened in random access mode, this value is the record length; for ordered files, this value is the number of buffered characters ." The length of a record cannot exceed 32767 bytes. The LEN clause is ignored for binary files.
Example: open "price. dat" for output as #1
Open "c: \ ABC. dat" for Radom as #1 Len = 256

2. Close [# file number] [, # file number]…… : Close the file
3. Seek # file number, position: the file pointer jumps to the specified position, in bytes. Value Range: 1 ~ Pow (2,31)-1
4. Seek (file number): returns the position of the pointer to the current file.
5. freefile (): Obtain an unused file number.
6. LOC (file number): returns the current read/write location of the specified file.
7. lof (file number): the length of the returned File
8. EOF (file number): used to test whether the file ends. If it ends, true is returned.
9. Print # file number, variable 1, variable 2 ,... Variable N: Write the values of each variable to an ordered file in sequence.
If it is print # file number, a blank line is written.
10. Write # file number, expression table... : Same as print
11. Input # file number, variable table .... : Read the ordered file and perform operations opposite to print
12. Line input # file number, string variable: Read a row from the ordered File
13. Input $ (n, # file number): reads a string of n characters from an ordered file.
14. Put # file number, [Record Number], variable: put any variable except the object variable and the array variable (including the subscript variable whose number contains a single array element).
Example: Put #2, filebuff
15. Get # file number, [Record Number], variable: Read a random file and execute the opposite operation as put
16. GET | put # file number, [location], variable: read/write binary file, location refers to the next read/write operation location.
17. Kill file name: delete an object
18. filecopy source file name. Target file name: copy file
19. Name: original file name as new file name: Command-heavy file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.