What are the common statements in the basics of VB language?
1. Assignment statement
Assignment of variable
Format:
[Let]
¨ Function: First calculate the value of the expression on the right side of the assignment number, and then assign the value to the variable.
Note:
"=" means "assignment" rather than "equal to", x = y and y = x are not equivalent.
The left side of "=" can only be variables, not values or expressions. The following statement is wrong:
4 = x y
a b/2 = 6
Only one variable can be assigned a value at a time. If you want to assign the same value to multiple variables, you can only use multiple assignment statements.
For example: sum = 0: i = 0 cannot be written as: sum = i = 0
Dynamic setting of object attributes and return of object attribute values
Dynamics of object attributes Setting
Format: object name. Attribute name =
For example:
Command1.Caption = "Calculation"
Text2.Text=Str(c)
¨ Note: The Name attribute can only be assigned a value in the properties window
¨ Return of object attribute value
¨ For example:
R = Val (Text1.Text)
Related recommendations: "FAQ"
2.Print statement
[
Function: Output the value of each element in the
Example
Private Sub Command1_Click()
a = 123: b = 456: c = 789
Form1.Print a; b; c ' Output on the form Form1
Print "China", "World", a b c 'Output on the form Form1
Picture1.Print "China", "World", a b c 'Output on the form Form1 On the picture box Picture1
Debug.Print "China", "World", a b c 'Output on the immediate window
Printer.Print "China", "World", a b c 'On the printer Output
End Sub
Note:
Can only output content on the form, picture box, printer, and immediate window
Print related functions
①Tab() function
Tab(N)
Function: Move the cursor to the position determined by N.
②Spc() function
Spc(N)
Function: Move the cursor to the position after N spaces.
③Cls method
[
Function: Clear the information displayed by the Print method.
④Format$ function
Format$ (expression, format string)
Function: Generate a string from data such as numerical value, string or date according to the specified format
3. Comment statement
The way to add a comment statement in Vb is to add comment content after the character "'" (i.e. single quotation mark) or use the form of Rem comment content
Refer to the example in the print statement
4. End statement
Syntax format: end
Function: Force the program to end running
The above is the detailed content of What are the common statements in the basics of VB language?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



VB is a high-level programming language. It is a general object-based programming language. It is a visual programming language that is structured, modular, object-oriented, and includes an event-driven mechanism to assist in the development environment. It adopts Intuitive graphical user interface design allows you to develop applications by dragging and dropping controls, setting properties and writing event handlers. This visual programming method allows developers to intuitively design and program interfaces without much coding experience. .

PHP is a widely used open source server-side scripting language that can handle all tasks in web development. PHP is widely used in web development, especially for its excellent performance in dynamic data processing, so it is loved and used by many developers. In this article, we will explain the basics of PHP step by step to help beginners from getting started to becoming proficient. 1. Basic syntax PHP is an interpreted language whose code is similar to HTML, CSS and JavaScript. Every PHP statement ends with a semicolon; Note

Int in VB refers to a function that takes an integer. Its syntax is such as "int(x)", which means taking the largest integer not greater than x; functions similar to the int function include the Fix function, which deletes the decimal part and returns the remainder. the next integer.

In VB, the operation of connecting to the database usually involves the following aspects: 1. Introducing the database connection library; 2. Creating the database connection object; 3. Configuring the connection string; 4. Opening the database connection; 5. Performing database operations; 6. Process the query results; 7. Close the database connection.

VB methods to connect to the database include using the ADO object library, using the OLEDB data provider, using the ODBC data source, etc. Detailed introduction: 1. Use the ADO object library method. ADO is a COM component used to access the database. You can connect to the database and execute SQL statements through ADO. You can use the ADODB.Connection object to establish a connection with the database, and then use the ADODB.Recordset object to perform queries and manipulate data; 2. Use the OLEDB data provider method and so on.

If you want to work in the IT industry, but do you want to learn programming, which technology should you choose? Of course it is Linux operation and maintenance. Linux is a very popular technology on the market, with a wide range of applications and good employment prospects, and is liked by many people. So the question is, can I learn Linux operation and maintenance with zero basic knowledge? In the server market, Linux system has a market share of up to 80% because of its advantages such as stability, security, free open source, efficiency and convenience. From this, it can be seen that Linux applications are very popular. Extensive. Whether now or in the future, learning Linux is a very good choice. As for whether it is possible to learn from scratch? My answer is of course. Oldboy Education Linux face-to-face class is specially designed for people with zero basic knowledge

Basic introduction to PHP: How to use the echo function to output text content. In PHP programming, you often need to output some text content to a web page. In this case, you can use the echo function. This article will introduce how to use the echo function to output text content and provide some sample code. Before starting, first make sure you have installed PHP and configured the running environment. If PHP is not installed yet, you can download the latest stable version from the PHP official website (https://www.php.net).

vb connection access database method: 1. Use ADO connection, first import the System.Data.OleDb module, then define a connection string, then create an OleDbConnection object and use the Open() method to open the connection; 2. Use DAO connection, first import Microsoft.Jet.OLEDB module, then define a connection string, then create a JetConnection object and use the Open() method to open the connection.