Put a possible error statement behind a try and, if an error occurs, execute a Catch statement,
Catch can have multiple, first catch cannot catch error, will be next catch statement
Captured. After all the processing is complete, the finally statement is executed.
You can use catch with one of the finally two in a try.........end try procedure
One, or two together,
Two: Protected, private, public package control
These three keywords are generally placed at the front of the statement and are placed in the overloads and overrides
Behind
Public is an engineering-level external access
Protected is the following internal access to the family level
Private is not providing non-local access
Three: ByVal sender as Object, ByVal e as System.EventArgs
This is the most rewarding event for passing arguments. is encapsulated within two objects,
If you want to pass the corresponding arguments, look for them inside the two objects, such as the current mouse position
E.x e.y. In VB. NET some of the events are to be written by yourself,
such as the form mouse process, the general plus this parameter in the parentheses in the back of the solution.
Four: Overloaded grammar overloads
such as: class Class1
Public Strtem As String
Overloads Public Sub Subx () Overload SUBX (a State)
Strtem= "3"
End Sub
Overloads Public Sub Subx (x As String) overload SUBX (B-shaped
Transient
Strtem=x
End Sub
End Class
If you call SUBX () there is no parameter in the middle, then VB automatically invokes the overload SUBX (A-shaped
State),
Overloads Public Sub Subx () Overload SUBX (a State)
Strtem= "3"
End Sub
The result is strtem= "3."
If you call this, SUBX ("This is a different result"), then VB automatically calls the heavy
Load subx (b status)
Overloads Public Sub Subx (x As String) overload SUBX (B-shaped
Transient
Strtem=x
End Sub
The result is strtem= "It's a different result."
You can call in a function, including in the API (of course vb.net no longer use WINAPI).
Even some of the most critical processes are no exception: such as the new process (this method Wangguorong in the article
Have introduced)
such as: class Class1
Overloads public Sub New ()
.........
.........
End Sub
Overloads public Sub New (s As String)
.........
.........
End Sub
End Class
There are also two ways of calling, such as the dim as Class1=new class Call before
A new process without parameters,
The dim asb As Class1=new Class ("string") invokes the second new procedure.
Remember, if a process or a function has only one state, it cannot be applied in this way. If you try
Figure using the Overloads keyword, the vb.net will appear with the wrong hint asking you to remove
Overloads
Five: Overrides rewrite
such as the common Dispose process:
Overrides public Sub Dispose ()
Mybase.dispose
Components. Dispose
End Sub
Overrides represents a complete rewrite of the procedures and functions provided by the parent class
Remember, however, that using overtype is a prerequisite for using the same procedure or function before the parent class.
Overrides keyword
VI: MyBase.New and Mybase.dispose
Ublic Sub New ()
MyBase.New
Form1 = Me
InitializeComponent
End Sub
Overrides public Sub Dispose () '
Mybase.dispose
Components. Dispose
End Sub
Both of these processes are available to any new project, MyBase.New calls the current class's
The new process of the parent class, you can also add parameters to the overloaded new procedure of the parent class. Such as:
Overloads public Sub New ()
MyBase.New ()
End Sub
Overloads Public Sub New (string)
MyBase.New (String)
End Sub
Seven: Structure construction
Custom types, such as:
Structure Type1
Dim x as Y
Dim A as B
.........
End Structure
This replaces the method used in VB6 to customize the type in Type.........end type.
Eight: return value
function functionname ()
Return X .....
End Funtion
His role is the same as the following:
function functionname ()
functionname = X .....
End Funtion
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.