If you know and Visual Basic for Applications will now start writing Visual Basic, Article process lists these four differences, which you get to the upgrade.
Visual Basic variables treated differently
In VBA, a variable with a Dim statement. For example:
DIM MyName As String
DIM MyNumber Integer
Then, you assign values to variables in separate statements. ForExample:
MyName = "Bob"
MyNumber = 1
Typically, you declare variables at the beginning of a subroutine. In Visual Basic you can declare and assign a variable the same time:
DIM MyName As String = "Bob"
DIM MyNumber As Integer = 1
Normally you will declare variables immediately before they are used, rather than at the top of a subroutine. You can also reduce or increase the value of a variable by 1, easily, and add strings to an existing one. For Example:
MyNumber + = 1
MyName & = "brush"
VBA does not support inheritance or Proper classes
In VBA, you do not need to know about classes (they are the things you create when you add a class module) use, and very few people do. One reason for this is that classes do not work really well in VBA: they are too cumbersome to create, and the concept of inheritance is not supported.
The classes are absolutely central visual contrast> Basic. Whether you're a web-based application or create a Windows Forms application, you will find it impossible to understand without a little about the properties and methods.
Visual Basic does not have default properties
Consider the Excel line of code:
ActiveCell = 1
This number shall be 1 to the value in the active cell, and is an abbreviation for:
ActiveCell.Value = 1
The reason this works is that each objecthas received a default property for a cell, it is its value. The price to be paid for this is that you have object variables, use of the word when assigning a value to one.
In Visual Basic, there is no concept of a default property, so you have to explain the things. For example, if you called txtName text box one line of code to crash:
me.txtName = "Bob"
This is because VB will be surprised that the property ofText field that you set equal to Bob.
Visual Basic preferred methods of functions
Suppose you want txtName find the first 3 characters of a text box called after it is converted to upper and back away and leading spaces. In Excel, you would write:
LEFT (UCASE (TRIM (me.txtName.Value)), 3)
Visual Basic as you can have many functions in VBA, that would be better written in VBFor example:
me.txtName.Value.toUpper.trim.Substring (0.2)
Conclusion
The new programming constructs for VB to use much more beautiful, and we now find it difficult when we have to resort to VBA programming.
Recommend : !: Computer-Zubeh?r g?nstig !: Shop For 50 Inch Lcd HDTV !: My Laptop Store !8!# Great Deals Jackie Chan Medallion
No comments:
Post a Comment