Variables, Formulas, and the .NET Framework in Visual Basic 2010 Part 2

Formula is a statement that combines numbers, variables, operators, and keywords to create a new value. Visual Basic contains several language elements designed for use in formulas. In this section, you’ll practice working with arithmetic (or mathematical) operators, the symbols used to tie together the parts of a formula. With a few exceptions, the arithmetic symbols you’ll use are the ones you use in everyday life, and their operations are fairly intuitive. You’ll see each operator demonstrated in the following exercises.

Arithmetic Operators











Using Parentheses in a Formula
You can use one or more pairs of parentheses in a formula to clarify the order of precedence or impose your own order of precedence over the standard one. For example, Visual Basic calculates the formula

Number = (8 – 5 * 3) ^ 2
 
by determining the value within the parentheses (–7) before doing the exponentiation—even though exponentiation is higher in order of precedence than subtraction and multiplication, according to the preceding table. You can further refine the calculation by placing nested parentheses in the formula. For example,

Number = ((8 – 5) * 3) ^ 2

directs Visual Basic to calculate the difference in the inner set of parentheses first, perform the operation in the outer parentheses next, and then determine the exponentiation. The result produced by the two formulas is different: the first formula evaluates to 49 and the second to 81. Parentheses can change the result of a mathematical operation, as well as make it easier to read.

Download Source Code E-Receipt System

Source Code E-Receipt System

Create receipt instantly using E-Receipt System. This example of source code E-Receipt System use MS Access Database in Visual Basic 2010 that you can use to learn Visual Basic .NET 2010.

DOWNLOAD

Variables, Formulas, and the .NET Framework in Visual Basic 2010


Variable
A variable is a temporary storage location for data in your program. You can use one or many variables in your code, and they can contain words, numbers, dates, properties, or other values. By using variables, you can assign a short and easy-to-remember name to each piece of data you plan to work with. Variables can hold information entered by the user at run time, the result of a specific calculation, or a piece of data you want to display on your form. In short, variables are handy containers that you can use to store and track almost any type of information.

Using variables in a Visual Basic program requires some planning. Before you can use a variable, you must set aside memory in the computer for the variable’s use. This process is a little like reserving a seat at a theater or a baseball game. I’ll cover the process of making reservations for, or declaring, a variable in the next section.

The Dim Statement
To declare a variable in Visual Basic 2010, type the variable name after the Dim statement. (Dim stands for dimension.) This declaration reserves room in memory for the variable when the program runs and lets Visual Basic know what type of data it should expect to see later. Although this declaration can be done at any place in the program code (as long as the declaration happens before the variable is used), most programmers declare variables in one place at the top of their event procedures or code modules.

For example, the following statement creates space for a variable named FirstName that will hold a textual, or string, value:

Dim FirstName as String

Use the As keyword to give the variable a particular type, and I’ve identified the type by using the keyword String. (You’ll learn about other data types later in this chapter.) A string variable contains textual information: words, letters, symbols—even numbers. I find myself using string variables a lot; they hold names, places, lines from a poem, the contents of a file, and many other “wordy” data.

Implicit Variable Declaration
If you really want to declare variables “the old way” in Visual Basic 2010—that is, without explicitly declaring them by using the Dim statement—you can place the Option Explicit Off statement at the very top of your form’s or module’s program code (before any event procedures), and it will turn off the Visual Basic default requirement that variables be declared before they’re used. This method is not recommend, but you might find it useful temporarily as you convert older Visual Basic programs to Visual Basic 2010.

Another possibility is to use the Option Infer statement, which was added to Visual Basic 2008. If Option Infer is set to On, Visual Basic will deduce or infer the type of a variable by examining the initial assignment you make. This allows you to declare variables without specifically identifying the type used, and allowing Visual Basic to make the determination. For example, the expression

Dim attendance = 100

will declare the variable named attendance as an Integer, because 100 is an integer expression. In other words, with Option Infer set to On, it is the same as typing

Dim attendance As Integer = 100

Likewise, the expression

Dim address = "Bireuen"

will declare the variable address as type String, because its initial assignment was of type String. If you set Option Infer to Off, however, Visual Basic will declare the variable as type Object—a general (though somewhat bulky and inefficient) container for any type of data.

If you plan to use Option Infer to allow this type of inferred variable declaration (a flexible approach, but one that could potentially lead to unexpected results), place the following two statements at the top of your code module (above the Class Form statement):

Option Explicit Off
Option Infer On

Option Explicit Off allows variables to be declared as they are used, and Option Infer On allows Visual Basic to determine the type automatically. You can also set these options using the Options command on the Tools menu, as discussed in Chapter 1, “Exploring the Visual Studio Integrated Development Environment.”

Creating Project in Visual Basic .Net 2010

You can start Visual Studio 2010, by selecting Start -> Programs -> Microsoft Visual Studio 2010 -> Microsoft Visual Studio 2010. You can create a new project in Visual Studio 2010 by clicking the New Project button on the Visual Studio Start Page or by clicking the File -> New -> Project option. When you perform one of these actions, the New Project dialog box is displayed, as shown in the following figure:

In the New Project dialog box, the Project Types pane displays various categories of projects that can be created. You can create a Visual Basic project or Other Languages project. If you want to deploy an application on other computers, you can use Setup and Deployment Projects under Other Project Types.

After you select a project type, the templates available for the selected project type are displayed in the Templates pane. You can choose the target .NET Framework for your application. A template creates the initial files, the code framework, and the property settings for the selected project type to help you start developing your application.

In order to create a Visual Basic Windows Forms Application, you need to perform the following steps:
  1. In the New Project dialog box, select Visual Basic from the Installed Templates pane and Windows Forms Application from the Templates pane.
  2. Type the name of the new project.
  3. Click OK.
User Interface Elements of Visual Studio .NET 2010 IDE

XNA Game Studio 4 Overview

Microsoft XNA Game Studio is a set of tools that allow students, hobbyists and independent developers to build games for both Microsoft Windows and Xbox 360. XNA Game Studio is based on the .NET Framework and includes custom managed code libraries, Xbox Live Support, and Games for Windows Live support to make multi-player game development easier. www.dreamspark.com.

Use Visual Studio to create games for Windows Phone, the Xbox 360 console, and Windows-based computers using XNA Game Studio 4.0 is a programming environment. XNA Game Studio includes the XNA Framework, which is a set of managed libraries designed for game development based on Microsoft .NET Framework.

XNA Game Studio 4 was announced and initially released as a "Community Technical Preview" at GDC on March 9, 2010, and in its final form on September 16, 2010. It adds support for the Windows Phone 7 platform (including 3D hardware acceleration), framework hardware profiles, configurable effects, built-in state objects, graphics device scalars and orientation, cross-platform and multi-touch input, microphone input and buffered audio playback, and Visual Studio 2010 integration.

Free Version of Visual Studio 2010 for Students


           If you are a student at the college and would like to use Visual Studio 2008 or 2010, you do not need to buy the software. The software is free of charge if you are a college student. How we can do that? Of course, Just Logon to DreamSpark and verify your account and you download the software that you’d like. You can even download a lot more. Before you can only use Visual Studio Express edition if you want to learn Visual Basic or Visual C#. Now, this is a must have download for every students.

I had enrolled STMIK Bina Bangsa Lhokseuamwe to DreamSpark website, but is still awaiting approval from the DreamSpark in order to contained in the list.

Follow the following instructions for students:
2. In the left sidebar click Sign In
If you don't have Windows Live account yet, please Sign Up. Otherwise, you can Sign in.
3.  After Sign In to Windows Live account, you will redirect again to DreamSpark, in the left sidebar of DreamSpark, click Get Verified. You will get some question that you need to answer as you specific.

4. For students at STMIK Bina Bangsa Lhokseumawe, please select STMIK BINA BANGSA LHOKSEUMAWE in School Selecter and click Continue.

Visual Studio LightSwitch 2011 Is Launching on July 26

As we all know, Microsoft has announced launching of Microsoft Visual Studio LightSwitch 2011, building business applications has never been easier – and it’s launching on July 26. Microsoft Visual Studio LightSwitch gives you a simpler and faster way to create high-quality business applications for the desktop and the cloud. LightSwitch is a new addition to the Visual Studio family.


What is the features?

QUICKLY CREATE HIGH-QUALITY BUSINESS APPLICATIONS

With LightSwitch, you can build custom applications that rival off-the-shelf solutions. Get a head start by using pre-configured screen templates that give your application a familiar look and feel. LightSwitch also provides prewritten code and other reusable components to handle routine application tasks, along with helpful step-by-step guidance. However, if you need to write custom code, you can use Visual Basic .NET or C#. You can deploy to the desktop, browser, or cloud to share your application with others more easily without the cumbersome installation processes.

EASILY ACCESS EXISTING SYSTEMS AND DATA

Applications created with LightSwitch support exporting data to Microsoft Office Excel for fast and easy sharing and reporting. You can also attach your application to existing data sources, which makes it easy to collect, analyze, and reuse information from a variety of data sources including Microsoft SQL Server, Microsoft SQL Azure, SharePoint, Microsoft Office Access (post-Beta), and other third-party data sources.

BUILD FOR TODAY, PREPARE FOR TOMORROW

With LightSwitch you can create custom applications for the way you do business. Keep your technology and business options open, while building a practical yet scalable application that matches your current needs now and in the future. The pre-built templates and components in LightSwitch are fully extensible, so you can get the specific functionality your application demands. In addition, your application can grow to meet the increasing demands of popular applications using the Microsoft Windows Azure Cloud Hosting option.

EXTEND YOUR APPLICATION WITHOUT HAVING TO REDESIGN IT

With LightSwitch you can create custom applications for the way you do business. Keep your technology and business options open. Visual Studio LightSwitch includes a lot of pre-built components for the most common business application tasks; however, there will be times when you will want more custom functionality. LightSwitch applications are flexible enough to support extensions for templates, data sources, shells, themes, business data types and custom controls. Get extensions from component vendors or develop them yourself using Visual Studio Professional, Premium or Ultimate.

VISUAL BASIC 2010 INTRODUCTION

Visual Basic 2010 is  the latest version of Visual Basic launched by Microsoft in 2010. VB2010 is almost similar to Visual Basic 2008,  but it has added many new features. Like Visual Basic 2008 , Visual Basic 2010 is also a full fledged Object-Oriented Programming(OOP) Language, so it has caught up with other OOP languages such as C++, Java,C# and others.

Before we start learn about Visual Basic .NET 2010, you must install the software. Visual Basic 2010 Express Edition is available free for download from the Microsoft site. Click on this link http://www.microsoft.com/express/downloads/ to download Visual Basic .NET 2010.

If you are a student and would like to use Visual Studio 2010, 2008 and 2005 Professional Editions, along with language-specific versions (Visual Basic, C++, C#, J#) of Visual Studio 2005 are available for free to students as downloads via Microsoft's DreamSpark program. The software is free of charge if you are a college student. Just logon to DreamSpark and verify your account and download the software that you’d like including Virtual PC. You can even download Windows Server 2003 and a lot more.

MICROSOFT VISUAL STUDIO 2010 OVERVIEW

Microsoft Visual Studio 2010 is a continuation of Microsoft Visual Studio, namely Visual Studio. NET 2008, which is produced by Microsoft. In February 2002 Microsoft is producing technologies. NET framework version 1.0, technology. NET is based on the order form. NET framework, so that every new product associated with the technology. NET will continue to evolve following the developments. NET Framework him.
 
In later developments, possible to create programs with technology. NET enables software developers will be able to use a cross-operating system, which can be developed on the Windows operating system can also run on other operating systems, eg on the Linux operating system, as has been done by Java programming by Sun Microsystems.
 
At this time many companies have updated the old applications created with Microsoft Visual Basic 6.0 to technology. NET because of the advantages offered, especially enables software developers to quickly mempu create a robust program, as well as to internet-based integration known as an XML web Service.

MICROSOFT VISUAL STUDIO 2010 SYSTEM REQUIREMENT
Software Requirement:
  • Windows XP (x86) SP3 : All edition except Starter Edition
  • Vista (32 and 64 bit) SP2 : All edition except Starter Edition
  • Windows 7 (32 and 64 bit)
  • Windows Server 2003 R2 (64 bit)
  • Windows Server 2008 (32 and 64 bit) SP2
  • Windows Server 2008 R2 (32 and 64 bit) 
 Hardware Requirement:
  •  1.6 GHz or faster
  • 1 GB RAM
  • 3GB Disk Space
  • DirectX 9 capable video card with 1024x768 or higher resolution

VISUAL STUDIO .NET INTEGRATED DEVELOPMENT ENVIRONMENT

The Visual Studio .NET Integrated Development Environment (IDE) provides you with a common interface for developing various kinds of projects for the .NET Framework. The IDE provides you with a centralized location for designing the user interface for the application, writing code, and compiling and debugging the application. The Visual Studio .NET IDE is available to all the programmers who use the languages in the Visual Studio .NET suite. At the moment, Visual Studio .NET supports languages such as Visual Basic, Visual C++, and Visual C#. Before we start using Visual Studio .NET for creating Visual Basic .NET applications, let us understand the various components of the Visual Studio .NET IDE.

Projects and Solutions
In Visual Studio .NET, an application can be made up of one or more items, such as files and folders. To organize these items efficiently, Visual Studio .NET has provided two types of containers: projects and solutions.

A project typically contains items that are interrelated. For example, you may create a project that contains items for connecting to the Sales database and allowing users to manipulate the data in the database. A project allows you to manage, build, and debug the items that make up an application. When you build a project, it usually results in the creation of an executable file (.exe) or a dynamic link library (.dll).
These files that are created as a result of building the project are called the project output.

A solution usually acts as a container for one or more projects. For example, you may create a solution containing two projects, one for manipulation of data and the other for generation of reports for the Sales division of an organization. Thus, a solution allows you to work on multiple projects within the same instance of the Visual Studio .NET IDE. A solution also allows you to specify settings and options that apply to
multiple projects.

When i post this article, Microsoft has released Visual Studio 2010 and Microsoft .NET Framework 4. Visual Studio 2010 and .NET Framework 4 have something for every developer. The new editor, now using Windows Presentation Foundation, delivers a more flexible, feature-rich environment that supports concepts such as the use of multiple monitors. This enables a developer to have one monitor with code, another with the user interface designer, and yet another with database structure.

Microsoft provides "Express" editions of its Visual Studio 2010 components Visual Basic, Visual C#, Visual C++, and Visual Web Developer at no cost. Visual Studio 2010, 2008 and 2005 Professional Editions, along with language-specific versions (Visual Basic, C++, C#, J#) of Visual Studio 2005 are available for free to students as downloads via Microsoft's DreamSpark program.

In the next part of the tutorial, I will be using Microsoft Visual studio 2010 in every project that we will make later.
 

About the Author

My name is Jakfar Zakaria. My friends call me Jakfar. I have lived such a tiring journey, about my education and others. Four years ago, I explore the computer network specializes in Linux Technology. And now I steeped about computer programming. I have little ability in computer programming, I focus on Visual Basic .NET programming language and PHP programming language. It takes a big sacrifice in studying it all, and my teacher is Google! Yups, Google! Google is a good teacher for me.

JOIN THE COMMUNITY!

TAKE A BREAK