vb_20130911

来源:互联网 发布:麦乐迪软件 编辑:程序博客网 时间:2024/06/14 19:37
macrogrammer[Public | Private] Sub name [(arglist)] [statements][Exit Sub][statements]End Sub[accessibility] Sub subname[(argumentlist)]   'Statements of the Sub procedure go here.End Sub[Optional] [ByVal|ByRef] [ParamArray] argumentname As datatypeOptional [ByVal|ByRef] argumentname As datatype = defaultvaluedeliver value or reference[Call] subname[(argumentlist)]Sub TellOperator(ByVal Task As String)   Dim Stamp As Date      ' Stamp is local to TellOperator.   Stamp = TimeOfDay()    ' Get current time for time stamp.   'Use MessageBox class of System.Windows.Forms namespace.   MessageBox.Show("Starting " & Task & " at " & CStr(Stamp))End SubDim declare variables and allocate storage space.Dim [WithEvents] varname[([subscripts])] [As [New] type] [, [WithEvents] varnam [([subscripts])] [As [New] type]]...Call TellOperator("file update")Option Explicitmust be declaredcan be execute success Option ExplicitPrivate Sub Command1_Click()Dim a As Stringa = "tttt"MsgBox (a)End SubPrivate Sub Command1_Click()a = "tttt"MsgBox (a)End Subexecute wrongOption ExplicitPrivate Sub Command1_Click()a = "tttt"MsgBox (a)End SubSet an object reference to a variable or propertyDim myForm As Form1Set myForm = New Form1myForm.showPublic Property Get shaperatio() As Long    shaperatio = mlngshaperatioEnd Propertydim a as new ClassAmsgbox a.shaperatiosingle is 4 bytes,double is 8 bytessingle greatest accuracy can be expressed approximately six digit after decimal placesdouble greatest accuracy can be expressed approximately 14 digit decimal placesPublic arrArgs  As VariantNot be explicitly declared as other types of variable data typespublic enum Season {      winter, spring, summer, fall;      private final static String location = "Phoenix";              public static Season getBest() {            if (location.equals("Phoenix"))                return winter;            else                return summer;      }}On Error Resume Nextthe code after this statement, if an error occur is not prompted to continue the statement followingKill used to delete fileOn Error GoTo 0Ban any error handler in current procedure.On Error Resume Nextcontinues to run after the error statementOn Error GoTo lineStartup error handler,start from the point line
原创粉丝点击