Академический Документы
Профессиональный Документы
Культура Документы
Wikimedia Foundation!
Live list of donations
Tax-deductibility of donations | FAQ | Financial statements (pdf)
Major
.NET Framework, Mono
implementations:
Influenced: None
o 7.1 Tutorials
The original Visual Basic .NET was released alongside Visual C# and
ASP.NET in 2002. C# — widely touted as Microsoft's answer to Java —
received the lion's share of media attention, while VB.NET (sometimes
known as VB7) was not widely covered. As a result, few outside the
Visual Basic community paid much attention to it.[citation needed]
Those who did try the first version found a powerful but very different
language under the hood, with disadvantages in some areas, including
a runtime that was ten times as large to package as the VB6 runtime
and an increased memory footprint.[citation needed]
Visual Basic 2005 is the next iteration of Visual Basic .NET, Microsoft
having decided to drop the .NET portion of the title.
For this release, Microsoft added many features in an attempt to
reintroduce some of the ease of use that Visual Basic is famous for —
or infamous, with respect to "newbie" programmers — including:
• Edit and Continue - probably the biggest "missing feature" from Visual Basic,
allowing the modification of code and immediate resumption of execution
• Design-time expression evaluation
• The My pseudo-namespace (overview, details), which provides:
o easy access to certain areas of the .NET Framework that otherwise require
significant code to access
o dynamically-generated classes (notably My.Forms)
• Improvements to the VB-to-VB.NET converter [2]
• The Using keyword, simplifying the use of objects that require the Dispose
pattern to free resources
• Just My Code, which hides boilerplate code written by the Visual Studio .NET
IDE
• Data Source binding, easing database client/server development
• Note that all procedure calls must be made with parentheses in VB.NET, whereas
these were only required for function calls (however in VB6 they could be used in
procedure calls as well by using the Call keyword)
• Also note that the names Command1 and Button1 are not obligatory. However,
these are default names for a command button in VB6 and VB.NET respectively.
• Actually, there is a function called MsgBox in the Microsoft.VisualBasic
namespace, but the System.Windows.Forms.MessageBox class is a preferred way
of displaying message boxes since it has more features and is less language-
specific.
The following example demonstrates a difference between VB6 and
VB.NET. Both examples unload the active window.
Classic VB Example:
Private Sub cmdClose_Click()
Unload Me
End Sub
A VB.NET example:
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnClose.Click
Me.Close()
End Sub
[Note the 'cmd' prefix being replaced with the new 'btn' prefix. The use
of 'cmd' as a prefix will generate an error, as only 'btn' is now
accepted; see above for default name explanation]
[edit] Controversy
End Class
The effect is to write the text Hello, world! to the output console. Each
line serves a specific purpose, as follows:
Public Class ExampleClass
This is a class definition. It is public, meaning objects in other projects
can freely use this class. All the information between this and the
following End Class describes this class.
Public Shared Sub Main()
This is the entry point where the program begins execution. It could be
called from other code using the syntax ExampleClass.Main(). (The Public
Shared portion is a subject for a slightly more advanced discussion.)
System.Console.WriteLine("Hello, world!")
This line performs the actual task of writing the output. Console is a
system object, representing a command-line console where a program
can input and output text. The program calls the Console method
WriteLine, which causes the string passed to it to be displayed on the
console.
[edit] Notes
1. ^ Only if strict type checking (Option Strict) is not enabled. Many VB.NET
developers assert that strict type checking must be enabled in all new projects and
only disabled for legacy code converted by the Upgrade Wizard.
2. ^ http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/dnvs05/html/VBUpgrade.asp
3. ^ http://msdn.microsoft.com/vbasic/default.aspx?pull=/library/en-
us/dnvs05/html/vb2005_generics.asp
4. ^ http://msdn.microsoft.com/vbasic/default.aspx?pull=/library/en-
us/dnvs05/html/vboperatoroverloading.asp
5. ^ http://www.theregister.co.uk/2005/02/22/real_slams_ms_patent/
6. ^ http://appft1.uspto.gov/netacgi/nph-Parser?
Sect1=PTO1&Sect2=HITOFF&d=PG01&p=1&u=%2Fnetahtml%2FPTO
%2Fsrchnum.html&r=1&f=G&l=50&s1=
%2220040230959%22.PGNR.&OS=DN/20040230959&RS=DN/20040230959
7. ^ http://www.microsoft.com/presspass/press/2006/apr06/04-
19VSExpressFreePR.mspx
8. ^ http://www.mvps.org/vb/index2.html?rants/vfred.htm
9. ^ http://vb.mvps.org/vfred/breaks.asp
10. ^ http://classicvb.org/petition/
11. ^ http://msdn.microsoft.com/vbasic/support/vb6.aspx
Views
• Article
• Discussion
• Edit this page
• History
Personal tools
Navigation
• Main page
• Community portal
• Featured content
• Current events
• Recent changes
• Random article
• Help
• Contact Wikipedia
• Donations
Search
Go Search
Toolbox
In other languages
• Dansk
• Deutsch
• Español
• Français
• 한국어
• Italiano
• עברית
• 日本語
• Norsk (bokmål)
• Polski
• Português
• Русский
• Simple English
• Svenska
• ไทย
• 中文
Visual Basic
From Wikipedia, the free encyclopedia
Paradigm: Event-driven
Developer: Microsoft
• 1 Derivative languages
• 2 Language features
• 3 Controversy
o 3.1 Weaknesses
3.1.1 Performance
3.1.2 Error Handling
3.1.3 Simplicity
o 3.2 Strengths
3.2.1 Debugging
3.2.2 Simplicity
o 3.3 Programming constructs not present in Visual Basic
o 3.4 Characteristics present in Visual Basic
• 4 Evolution of Visual Basic
o 4.1 Timeline of Visual Basic (VB1 to VB6)
• 5 References
• 6 See also
• 7 External links
area.Text = Str$(a)
End Sub
Another Example to write the words "Hello world" on the form:
Private Sub Form1_Load()
Print "Hello World"
End Sub
• VBScript is the default language for Active Server Pages and can be used in
Windows scripting and client-side web page scripting. Although it resembles VB
in syntax, it is a separate language and it is executed by the Windows Script Host
as opposed to the VB runtime. These differences can affect the performance of an
ASP web site (namely inefficient string concatenation and absence of short-cut
evaluation). ASP and VBScript must not be confused with ASP.NET which uses
Visual Basic.Net or any other language that targets the .NET Common Language
Runtime.
• Visual Basic .NET is Microsoft's designated successor to Visual Basic 6.0, and is
part of Microsoft's .NET platform. The VB.NET programming language is a true
object-oriented language that compiles and runs on the .NET Framework.
VB.NET is a totally new tool from the ground up, not backwards compatible with
VB6. For this reason, it was suggested by Bill Vaughn, and wholeheartedly
embraced by the user community, that it ought to have been given an alternative
name. Visual Fred (or VFred for short) was the consensus choice. VB.NET ships
with a rudimentary utility to convert legacy VB6 code, although the inefficient
nature of the resulting code (due to major differences between the two languages)
often leads programmers to prefer manual conversion instead. Indeed, automated
conversion is seen as a fantasy.
[edit] Controversy
To meet Wikipedia's quality standards, this section may require cleanup.
Please discuss this issue on the talk page, and/or replace this tag with a more specific message.
Editing help is available.
This section has been tagged since May 2006.
Visual Basic is seen as a controversial language; many programmers
have strong feelings regarding the quality of Visual Basic and its ability
to compete with newer languages. It was designed to be a simple
language. In the interest of convenience and rapid development, some
features like explicit variable declaration are turned off by default,
something that can be easily changed. This leads to some
programmers praising Visual Basic for how simple it is to use, but can
also lead to frustration when programmers encounter problems that
the features would have detected. For instance, in Visual Basic a
common mistake is to incorrectly type the name of a variable, creating
a new variable with a slightly different name.
[edit] Weaknesses
[edit] Performance
Visual Basic does not have exception handling with the same
capabilities of C++ or Java, but the On Error facility does provide
nonlocal error handling with features similar to Windows Structured
Exception Handling, including the ability to resume after an error (a
feature that is not provided by either of the other two languages,
although of dubious utility in production code).
[edit] Simplicity
Many critics[citation needed] of Visual Basic explain that the simple nature of
Visual Basic is harmful in the long run. Many people have learned VB
on their own without learning good programming practices. Even when
VB is learned in a formal classroom, the student may not be introduced
to many fundamental programming techniques and constructs, since
much of the functionality is contained within the individual components
and not visible to the programmer. Since it is possible to learn how to
use VB without learning standard programming practices, this often
leads to unintelligible code and workarounds. Second, having many of
the checks and warnings that a compiler implements turned off by
default may lead to difficulties in finding bugs. Experienced
programmers working in VB tend to turn such checks on.
Many of the criticisms fired at Visual Basic are in fact criticisms of its
ancestor, BASIC. A famous formulation by Edsger Dijkstra states, "It is
practically impossible to teach good programming to students that
have had a prior exposure to BASIC: as potential programmers they
are mentally mutilated beyond hope of regeneration [1]" (Dijkstra was
no less scathing about FORTRAN, PL/I, COBOL and APL).
[edit] Strengths
[edit] Debugging
[edit] Simplicity
• Inheritance. Visual Basic versions 5 and 6 are not quite object oriented languages
as they do not include implementation inheritance. VB5 and 6 do, however,
include specification of interfaces. That is, a single class can have as many
distinct interfaces as the programmer desires. Visual Basic provides a specific
syntax for access to attributes called Property methods, and this is often
implemented using getters and setters in C++ or Java. Python has an equivalent
notation to VB6's property Let and Get.
• Threading support (can be done by using external Windows functions).
• C++ or Java exception handling. Error handling is controlled by an "On Error"
statement, which provides similar functionality to Windows Structured Exception
Handling.
• Typecasting. VB instead has conversion functions.
• Equivalents to C-style pointers are very limited.
• Visual Basic is limited to unsigned 8-bit integers and signed integers of 16 and 32
bits. Many other languages provide wider range of signed and unsigned integers.
• 32-bit Visual Basic is internally limited to UTF-16 strings, although it provides
conversion functions to other formats (16-bit Visual Basic is internally limited to
ASCII strings).
• Visual Basic doesn't allow constant variables to contain an array. Therefore extra
processing is required to emulate this.
While Visual Basic does not naturally support these features,
programmers can construct work-arounds to give their programs
similar functionality if they desire.
• Boolean constant True has numeric value -1. In most other languages, True is
mapped to numeric value 1. This is because the Boolean data type is stored as a
16-bit signed integer. In this construct -1 evaluates to 16 binary 1s (the Boolean
value True), and 0 as 16 0s (the Boolean value False). This is apparent when
performing a Not operation on a 16 bit signed integer value 0 which will return
the integer value -1, in other words True = Not False. This inherent functionality
becomes especially useful when performing logical operations on the individual
bits of an integer such as And, Or, Xor and Not.
• Logical and bitwise operators are unified. This is unlike all the C-derived
languages (such as Java or Perl), which have separate logical and bitwise
operators.
• Variable array base. Arrays are declared by specifying the upper and lower
bounds in a way similar to Pascal and Fortran. It is also possible to use the Option
Base statement to set the default lower bound. Use of the Option Base statement
can lead to confusion when reading Visual Basic code and is best avoided by
always explicitly specifying the lower bound of the array. This lower bound is not
limited to 0 or 1, because it can also be set by declaration. In this way, both the
lower and upper bounds are programmable. In more subscript-limited languages,
the lower bound of the array is not variable. This uncommon trait does not exist in
Visual Basic .NET and VBScript.
• Relatively strong integration with the Windows operating system and the
Component Object Model.
• Banker's rounding as the default behavior when converting real numbers to
integers.
• Integers are automatically promoted to reals in expressions involving the normal
division operator (/) so that division of an odd integer by an even integer produces
the intuitively correct result. There is a specific integer divide operator (\) which
does truncate.
• By default, if a variable has not been declared or if no type declaration character
is specified, the variable is of type Variant. However this can be changed with
Deftype statements such as DefInt, DefBool, DefVar, DefObj, DefStr. There are 12
Deftype statements in total offered by Visual Basic 6.0.
• Visual Basic 1.0 for DOS was released in September 1992. The language itself
was not quite compatible with Visual Basic for Windows, as it was actually the
next version of Microsoft's DOS-based BASIC compilers, QuickBASIC and
BASIC Professional Development System. The interface was textual, using
extended ASCII characters to simulate the appearance of a GUI.
• Visual Basic 2.0 was released in November 1992. The programming environment
was easier to use, and its speed was improved. Notably, forms became
instantiable objects, thus laying the foundational concepts of class modules as
were later offered in VB4.
• Visual Basic 3.0 was released in the summer of 1993 and came in Standard and
Professional versions. VB3 included version 1.1 of the Microsoft Jet Database
Engine that could read and write Jet (or Access) 1.x databases.
• Visual Basic 4.0 (August 1995) was the first version that could create 32-bit as
well as 16-bit Windows programs. It also introduced the ability to write non-GUI
classes in Visual Basic.
• With version 5.0 (February 1997), Microsoft released Visual Basic exclusively for
32-bit versions of Windows. Programmers who preferred to write 16-bit programs
were able to import programs written in Visual Basic 4.0 to Visual Basic 5.0, and
Visual Basic 5.0 programs can easily be converted with Visual Basic 4.0. Visual
Basic 5.0 also introduced the ability to create custom user controls, as well as the
ability to compile to native Windows executable code, speeding up calculation-
intensive code execution.
• Visual Basic 6.0 (Mid 1998) improved in a number of areas, including the ability
to create web-based applications. VB6 is currently scheduled to enter Microsoft's
"non-supported phase" starting March 2008.
• Mainstream Support for Microsoft Visual Basic 6.0 ended on March 31, 2005.
Extended support will end in March 2008. In response, the Visual Basic user
community expressed its grave concern and lobbied users to sign a petition to
keep the product alive. Microsoft has so far refused to change their position on the
matter. Ironically, around this time, it was exposed that Microsoft's new anti-
spyware offering, Microsoft AntiSpyware, was coded in Visual Basic 6.0.[5].
Windows Defender Beta 2 was rewritten as C++/CLI code, as mentioned in Paul
Thurrott's review of this product.
[edit] References
1. ^ Martin LaMonica (2003-05-07). Study: Visual Basic use may be slipping.
CNET. Retrieved on 2006-01-25.
2. ^ http://www.tiobe.com/tpci.htm
3. ^ If you want that a, b and c all be an integer, you should write: "Dim a as integer,
b as integer, c as integer" or "Dim a%, b%, c%".
4. ^ Parentheses must be used for function arguments. For subroutines, parentheses
may not be used unless the optional keyword Call appears before the subroutine
name.
5. ^ Andrew Orlowski and Carey Bishop (2005-07-22). MS Anti-Spyware built on
MS Abandonware. The Register. Retrieved on 2006-10-04.
• VBKeys
• VBForums
• Utter Access Forums
• HashVB Wiki
• Beginner Visual Basic 6 tutorials
• VB 6.0 at MSDN
• VB City
• VB Lessons on Free-Ed.net
• Visual Basic 6.0 Tutorials by Gilberto E. Urroz
• Visual Basic at MSDN (primarily supports the VB.Net version)
• Visual Basic Section on About.com
• Visual Basic Section on Developer Fusion
• Visual Basic Tutorial for Beginners
• .VB File Extension Information FileInfo.net
• Project Semplice: VB on the Java Virtual Machine
• Visual basic programming for MMORPG cheat writers
• Planet Source Code - A very large collection of free source code
• FreeVBCode.com - Free source code collection devoted to Visual Basic
• Visual Basic 2005 Express (free edition) net installer
• Visual Basic 2005 Express (free edition) cd-image
• VB 5 Control Creation Edition, Download free here.
• Visual Basic for DOS (Free Edition) Download
• VBCode.com Free Visual Basic code snippets and downloads
• Hashtable Implementation For VBA and VB6
• "The Father of Visual Basic" - History of the "Visual" part of VB
• VB Wikia Wiki - Another wiki for visual basic
• Article
• Discussion
• Edit this page
• History
Personal tools
Navigation
• Main page
• Community portal
• Featured content
• Current events
• Recent changes
• Random article
• Help
• Contact Wikipedia
• Donations
Search
Go Search
Toolbox
In other languages
• العربية
• Български
• Català
• Česky
• Dansk
• Deutsch
• Eesti
• Español
• Esperanto
• Euskara
• Français
• 한국어
• Hrvatski
• Bahasa Indonesia
• Italiano
• עברית
• Magyar
• Bahasa Melayu
• Nederlands
• 日本語
• Norsk (bokmål)
• Polski
• Português
• Română
• Русский
• Simple English
• Slovenčina
• Slovenščina
• Suomi
• Svenska
• தமிழ
• ไทย
• Tiếng Việt
• Türkçe
• 中文