Starting from the basic concept and syntax
Learn a language, especially now is the development of visualization, but I suggest you still want to go to drag a few controls first, but let's take a look at the concept, grammar and norms of this language. Although VB.NET is very close to the previous VB6, because the current VB.NET is a new object-oriented language, the two are still some of them. As everyone knows, now VB.NET has fully supported various object-oriented features, and some of the features needed by other .NET environments: inheritance, overload, rewriting properties, and methods, implement constructor and Destructor, Interface, Entrusted, Exception, Namespace, Aquality, Feature Programming, Multithread, Shared Member. (We will gradually explore these characteristics in the note in the following notes.)
Simply describe the grammar of VB.NET, although it and VB6 are like this like. So telling the statement of VB.NET is actually a review of the VB6 statement, but some statements are not available to the original VB6.
VB.NET statement divided into: declarative statement, assignment statement, conditional statement, cyclic statement, array processing statement, abnormal statement, control flow statement, call statement, lock statement
The statement statement is in VB.NET, which is often referred to as a declaration of variables. We use the DIM modifier for local variables. And can still use const to modify the variable as a constant, Static as a description of the static variables remain effective.
Declaration Example (for the class and array we described later)
Const S as string = "hello" 'constant local variable
DIM B AS Boolean 'Rules Local Variable
Static I as INT32 'Static Local Variable
Variable accessibility The above three variables are partial variables, and we know that local variables are only visible in declaring their area, which cannot be accessed outside of this range, for those who need more access, VB.NET A richer modified keyword is provided.
Accessibility modification
description
Public declaration elements are common, no accessibility to common elements. The Private declaration element can only be accessed from the same module, class or structure. The protected declaration element can only be accessed from the same class, or in the derived class of the class. The Friend declaration element can be accessed from the same project, but cannot be accessed from the project. Protected Friend declaration elements can be accessed from the derived class or in the same item.
Accessibility example (note TestB, TestC and Testa relationship)
Public Class Testa
Public I as int32 = 100 'Access is unlimited
Private S as string = "Hello" 'only Testa can be accessed
Protected B as boolean = true 'only Testa and its derived class can be accessed
Friend d as double = 3.1415926 'Only the same project class can be accessed
Protected Friend L as long = 100000 '
END CLASS
Public Class TestB
Inherits Testa 'inherits Testa
Public Sub New ()
Mybase.b = false
Mybase.d = 3.14
Mybase.i = 10
Mybase.l = 10000
End Sub
END CLASS
Public Class TestC
Public Sub New ()
Dim a as new testa
A.D = 3.14
A.i = 10
A.l = 1000
End Sub
END CLASS