Vb. NET Syntax Summary

Source: Internet
Author: User

I am proficient in C # programming, VB No development experience, project maintenance needs, deliberately compiled under the VB syntax, to do evil. Programming ideas are interoperable, all Microsoft Born, the language is similar.

         
    (2) Instantiate a class or object Dim openFileDialog1 As New OpenFileDialog () Dim clsclass As New Clsclass ()    (3) declares an array of Dim fileNames as Str ing () = New String (3) {}      
    (4) Declares a generic type Dim list as New list (of T) ()    
    Throw New Exception (ex. Message, ex)
Three, conditional judgment statement
For each item in the List           //exit for
V. Procedures and functions
Public Function function name (byval/byref parameter name as Integer) as type
' Result = str1  
Dim str2 as String = "222"
Public shared Function fnxxx () As String ' shared refers to static methods equivalent to the static keyword inside C #.   
End Module
Call: Modulename.fnxxx (). You can also call Fnxxx () directly. There is a direct way to-------------------------------------------------------------------------------------------module , these methods are automatically static (or called Shared--vb. NET keywords are shared), these methods can be called directly, so module is not instantiated, there is no need to instantiate the module can not inherit, and cannot implement the interface module may have classes, but in fact, this class does not need to really through the module as a prefix to reference. So the module is a bit virtual concept module can be organized into the namespace, because the module is actually a virtual, so its method can also be directly outside the namespace call.    
Private Sub Rdbfeedchannelany_click (ByVal sender as System.Object, ByVal e as System.EventArgs) Handles rdbfeedchannel1.c Lick, Rdbfeedchannel2.click, Rdbfeedchannel3.click
private void radioButton_CheckedChanged (object sender, EventArgs e)        {if (this.radioButton1.Checked)            {                               }        } Eight, Overloads keyword, implement overloaded functions.   Class1 Overloads public Sub New ()//constructor ...... End Sub
Ix. WithEvents is used to declare an object that has its own event with the object it declares. When the object has a raiseevent inside it, the outside will receive it. Handles is used to receive this WithEvents object event. For example, one of your objects has an event a, during execution, this object RaiseEvent A, then the caller's handles object. A sub will be executed.

Vb. NET Syntax Summary

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.