When talking about vb.net can make people think of VB, is really VB and vb.net like a mother born of a pair of twins, long basic identical, the use of the rules are mostly the same. Even so, the two are fundamentally different: vb.net is object-oriented and VB is process-oriented. It is like twins who are similar in nature, but the temperament they acquired is quite different: one is lively and cheerful, the other is silent.
OK, the next, we will come to know the vb.net, but also to recall the next VB. I will not elaborate on the familiar specifications here. Of course, the first contact vb.net still have a lot of understanding is not in place, but also ask you more guidance.
First, VB. NET Language Foundation
1. Code Common sense and naming convention
2. Variables, constants and basic types
3. Common internal functions
4. Operators and expressions
ii. Structured Programming1. Sequential structure
2. Select structure
If Expression then
statement block
End If
Or
If Expression then
Statement Block 1
Else
Statement Block 2
End If
Or
If expression 1 then
Statement Block 1
ElseIf Expression 2 Then
Statement Block 2
.....
End If
orSelect Case Expression
Case Expression List 1
Statement Block 1
.....
End Select
3. Cyclic structure
For loop variable = Initial to final value
Loop Body
Next loop variable
three, array1. One-dimensional arrays
2. Multidimensional arrays
3. For each statement: A statement that iterates over every element in a data structure, such as an array, an object collection, and so on
format: For each variable name in array or object collection
Loop Body
NEXT Variable Name
function: A statement that iterates over every element in a data structure, such as an array, an object collection, etc.
Iv. Process1. Function procedure (functions): return value2. Sub procedure: no return value3. Parameter passing: formal parameter, argument, address, pass value.
v. Object-oriented Programming1. Use of classes: Create (Class), define members (data members, properties, methods, and events)format:
Access modifier Class class name
Define Content
End Class
2, the use of objects:format: Declare object variable name as new class nameDim object name as Class name
Object name =new class name
3. Namespaces: Direct addressing and imports keyword addressingDirect addressing: Any namespaces that are included in assemblies referenced by programs can be used in code, Eg:Console.WriteLine ("hello! ")improts keyword: Another way to avoid entering a long name is to use the Improts keyword to introduce the namespace specified by namespace into the current application.
Format:imports<namespace>
Note: All imports statements must be written at the top of all the code files used;
If you import two namespaces in which a class with the same name is used, then you need to qualify the name in direct addressing, otherwise two of the semantics are generated.
4. Constructors and destructors for classesconstructor: A method that is called automatically when a class is initialized, primarily to initialize an object when it is created, that is, to assign an initial value to an object member.
Format: public class name
Public Sub New ()
.....
End Sub
End Class
Note: The name of the function is fixed and must be new, and the access modifier is public;
The function is automatically called by the system when the object is created, and cannot be called directly in the program;
The function must be implemented with a sub-procedure, with no return value and no byref parameters;
functions can be overloaded;
without a constructor defined, the system automatically creates a default constructor for it, with no arguments and no procedural body.
5. Design mode:encapsulation, inheritance, overloading, rewriting, polymorphism, interfaces, events, delegates
Vb. NET Summary