After studying this unit, you will be able to:
- Discuss visual basic elements
- Explain object-oriented programming in VB.NET
- Understand visual basic.net framework
- Discuss common type system
- Elaborate VB.NET features
- Explain .NET framework
- Understand VB.NET as a language in .NET framework
Computer programming, often shortened to programming, scripting, or coding is the process of designing, writing, testing, debugging, and maintaining the source code of computer programs.
This source code is written in one or more programming languages such as C++, C#, Java, Python, Smalltalk, etc. The purpose of programming is to create a set of instructions that computers use to perform specific operations or to exhibit desired behaviors. The process of writing source code often requires expertise in many different subjects, including knowledge of the application domain, specialized algorithms and formal logic. Within software engineering, programming is regarded as one phase in a software development process.
Visual basic is a high level programming language developed from the earlier DOS version called BASIC. Visual Basic .NET is the latest technology introduced by Microsoft with tons of new features including the .NET framework. Educational institutes, Universities and Software Development companies have migrated to VB.NET now but Visual Basic 6 is still widely learned and taught.
Learning Visual Basic 6 is quite easier than other programming languages such as C++, C#, Java etc. This is because Visual Basic enables you to work in a graphical user interface where you can just drag and drop controls that you want to work with where you have to write bunches of code to create in C++ or C# or even in Java. If you are new to programming and want to start it in the smoothest and easiest way, then you should start it with Visual Basic.
Sometime in the July 2000, Microsoft announced a whole new software development framework for Windows called .NET in the Professional Developer Conference (PDC). Microsoft also released PDC version of the software for the developers to test. After initial testing and feedback Beta 1 of .NET was announced. Beta 1 of the .NET itself got lot of attention from the developer community.
When Microsoft announced Beta 2, it incorporated many changes suggested by the community and internals into the software. The overall ‘Beta’ phase lasted for more than 1 ½ years. Finally, in March 2002 Microsoft released final version of the .NET framework. One thing to be noted here is the change in approach of Microsoft while releasing this new platform.
Unlike other software where generally only a handful people are involved in beta testing, .NET Notes was thrown open to community for testing in its every pre-release version. This is one of the reasons why it created so many waves of excitement within the community and industry as well. Microsoft has put in great efforts in this new platform. In fact Microsoft says that its future depends on success of .NET.
The development of .NET is such an important event that Microsoft considers it equivalent to transition from DOS to Windows. All the future development –
including new and version upgrades of existing products – will revolve around .NET. So, if youwant to be at the forefront of Microsoft Technologies, you should be knowing .NET.
1.1 Elements of Visual Basic
The two basic elements of Visual Basic are the GUI and the code associated with the application that makes it respond to events occurred as a result of a user action.
1.1.1 Visual Element
IDE is a term commonly used in the programming world to describe the interface and environment that we use to create our applications. It is called integrated because we can access virtually all of the development tools that we need from one screen called an interface. The IDE is also commonly referred to as the design environment, or the program.
The Visual Basic IDE is made up of a number of components:
- Menu Bar
- Tool Bar
- Project Explorer
- Properties Window
- Form Layout Window
- Form Designer
- Object Browser
1.1.2 Language Element
Microsoft Visual Basic code is written in units called procedures. A procedure contains a series of Visual Basic statements that perform an operation or calculate a value. An event procedure is a procedure that runs in response to an event initiated by the user or program code, or triggered
by the system. Its syntax is,
Private Sub button1_Click()
- Object-oriented Programming in VB.NET
Before moving to the language syntax, let’s formally define the key OO concepts and terms that will be used in this unit beginning with encapsulation, polymorphism, and inheritance.
Encapsulation means that an object can hide its internal data structures from consumers of the object. Therefore, all of the object’s internal data is manipulated through members (methods, properties, events, fields) of the object, rather than through direct references.
The primary benefits of encapsulation are maintainability and reusability. Code that takes advantage of encapsulation is more maintainable because consumers of the code work with the object through its public members. With a fully encapsulated object, for example, code outside the object cannot directly change a variable declared inside the object. By shutting off this direct
access, fewer bugs are introduced because consumers of the object cannot inadvertently change the state of an object at run-time.
Abstracting the internal data of the object from consumers also leads to greater reusability. This follows because encapsulation leads to fewer dependencies between the consumer and the class and fewer dependencies is a prerequisite for creating reusable software.
The second characteristic of OO systems is polymorphism. This concept is defined as the ability to write code that treats objects as if they were the same when in fact they are different. In other words, polymorphism allows you to write code that is generic across a set of objects that provide the same public members. Underneath the covers, each object might be implemented differently. However, as far as the consumer is concerned, each object looks the same and can be treated as such. In VB.NET, polymorphism can be created using both classes and interfaces.
The benefits of polymorphism revolve around the central fact that consumers of objects do not have to be aware of how the object performs its work, only that it does so through a specific set of members.
This makes writing code that uses objects simpler by allowing the code to treat the object as if it were a black box, which leads to increased maintainability. Along the same lines, polymorphism allows you to write less code because each individual object does not have to be dealt with separately. Finally, polymorphism lends itself to writing code that can be reused because it will not be specific to a particular object.
The final OO concept is inheritance. Inheritance allows objects to share their interfaces (the definition of their members) and/or implementation in a hierarchy. For example, Tyrannosaurus and Velociraptor objects might be derived or inherited from a more generic Theropod object.
All three objects share a basic set of members and, possibly, behaviors, such as carnivorousness,although the descendant objects might also include additional members or override members of Theropod. Inheritance allows objects to become more specific further down the hierarchy by adding additional members.
In a nutshell, inheritance allows objects to reuse features (either their definition or their code) of other objects to which they are naturally related. The primary benefit of inheritance is, thus, reuse. Obviously, inheritance and polymorphism are closely related, and, in fact, inheritance is what makes polymorphism possible in OO designs.
It is always the case that objects that are in an inheritance relationship can be treated polymorphically. For example, if the Velociraptor object is inherited from the Theropod object, any consumer that is designed to work with Theropod objects will also work with Velociraptor objects.
VB.NET developers can benefit from inheritance in two ways: through interface inheritance and implementation inheritance. Interface inheritance allows only the definition of the object to be reused, whereas implementation inheritance allows the actual code written for the ancestor object (and its ancestors all the way down the line) to be reused.
- Visual Basic .NET
Visual Basic .NET is an Object-oriented programming language designed by Microsoft. With the word “Basic” being in the name of the language, you can already see that this is a language for beginners. There are people who criticize VB.NET because of the simplicity of the syntax, but VB.NET has the ability to create very powerful and sophisticated applications.
VB.NET is a great place to start because of how easy and straight forward it is. The syntax is easy and you will not find yourself writing hundreds of lines of code as there are many shortcuts that make coding so much easier in this language.
Let’s take a look at the VB.NET syntax. The purpose of typing code is to instruct the application what to do. It’s not as easy as typing “Hey application, multiply 5 by 83 but it’s pretty darn close!
If you wanted to tell your application to show a Message Box telling you that
HowToStartProgramming.com is awesome, this would be the code you would use:
MessageBox.Show(“HowToStartProgramming.com is awesome”)
Microsoft Visual Basic .NET is a programming environment used to create Graphical User Interface (GUI) applications for the Microsoft Windows family of operating systems. It usually ships in two types, either by itself or as part of Microsoft Visual Studio .NET.
To use the lessons on this site, you must have installed either Microsoft Visual Basic .NET 2003 or Microsoft Visual Studio .NET 2003. After installing Microsoft Visual Studio .NET 2003, to use the programming environment, you must first open it. To do that, you would click Start -> (All) Programs -> Microsoft Visual Studio .NET 2003 -> Microsoft Visual Studio .NET 2003.
In the early days of Microsoft DOS, there was a language called Basic. It provided a simplified and easy way to create small applications using words very close to the English language. Since the language was easy, it became popular with the help of Microsoft operating systems gaining ground. To continue this tendency and provide more support for Basic, Microsoft used that language as the platform to create Graphical User Interface (GUI) applications.
Once again, this move was welcomed and the language became the widely accepted Visual Basic. The Microsoft Visual Basic programming environment became very popular for its ease of use and it was a candidate for serious productive applications.
REPEAT YOUR GREATEST PROJECT SUCCESSES
When every project is one-of-a-kind, how do you repeat your greatest successes? You try to apply consistent processes, but shifting personnel, new technologies, and greater demands interfere. The answer may lie in software designed specifically to meet the challenges of design and construction project delivery.
Improve these aspects of collaboration and project information management:
- Keep from drowning under a firehose of information.
- Remove barriers to collaboration with other members of your project team.
- Make sure everyone has the right information at the right time, and automatically log that you did so.
- Spend less time as an administrator so you can spend more time as an architect.
Lots of factors conspire to slow down project delivery. Incorrect information leads to rework. Submitting and RFIs get hung up in processing. Crews run late, which ripples across teams that follow them on the schedule. But new software for collaboration and project information management solves these problems, and more.
- Be assured teams are working with the latest information.
- Know the status of every submittal, RFI, design change and more.
- Make well-informed decisions you don’t have to change later.
- Succeed at lean project delivery through improved visual planning and more accurate, timely reports.