The document discusses the .NET framework and its key components - the Common Language Runtime (CLR) and .NET Framework class library. The CLR handles running applications by compiling code into an intermediate language (IL) and then translating IL into machine code. The class library provides pre-written code for common tasks that applications can utilize. Visual Basic .NET applications interact with the .NET framework through assemblies compiled to IL rather than traditional EXE files. The document also describes the Visual Studio integrated development environment and its various components used for building .NET applications.
The document provides an introduction to the Microsoft .NET framework. It discusses that .NET is a development platform and runtime environment that includes a virtual machine, common language runtime, and class libraries. It supports building applications for web, Windows desktop, services and more using languages like C#. The .NET framework provides a consistent programming model, code execution environment, and class libraries to simplify development.
The document discusses the seven pillars of ASP.NET that differentiate it from previous web development platforms. These pillars include: 1) ASP.NET being integrated with the .NET Framework; 2) ASP.NET being compiled rather than interpreted; 3) ASP.NET being multilanguage; 4) ASP.NET being hosted by the Common Language Runtime; 5) ASP.NET being object-oriented; and 6) ASP.NET supporting all browsers. The document provides details on each pillar to explain the advantages ASP.NET provides to web developers.
The document provides an overview of the Visual Studio integrated development environment (IDE). It describes popular Visual Studio features like IntelliSense, code cleanup, refactoring, and debugging tools. It also explains how to install Visual Studio, create a simple "Hello World" console app project, add and run code to prompt for a user's name and display a greeting, and view the output in the console window.
The document discusses the seven pillars of ASP.NET that differentiated it from previous web development platforms when it was first released. These pillars include: 1) ASP.NET being integrated with the .NET Framework; 2) ASP.NET applications being compiled instead of interpreted; 3) ASP.NET being multilanguage; 4) ASP.NET being hosted by the Common Language Runtime; 5) ASP.NET being object-oriented; 6) ASP.NET supporting all browsers; and 7) ASP.NET having a stateful programming model.
This document provides an introduction and overview of VB.NET (Visual Basic .NET). It discusses what VB.NET is, its features, why it is used as a professional language, advantages and disadvantages. It also describes the structure of a VB.NET program, including namespaces, classes, modules, procedures, variables, and the main procedure. It explains the compilation and execution process of a VB.NET program in Visual Studio. An example VB.NET "Hello World" program is provided to demonstrate the core components.
The document discusses the introduction and history of .NET technology and Visual Basic .NET (VB.NET). It provides details on:
- The .NET framework which provides a development framework for building applications and web services.
- VB.NET which is a programming language that targets the .NET framework and is a successor to Visual Basic 6. It discusses the various versions of VB.NET released.
- Features of .NET such as interoperability, common language runtime, language independence, security and portability.
- The evolution of software development approaches from procedure-oriented to structure-oriented to object-oriented.
An automatic answer checker application compares student answers to exam questions against original answers stored by an administrator to allocate marks. The system uses artificial intelligence to evaluate subjective answers similarly to a human. Administrators can create questions and answers that are stored in a database. Students can take tests by typing their answers, which are then compared to the original answers to determine marks.
This document contains a summary of questions that are commonly asked during .NET interviews. The author collected material from various websites to compile it into a single file for reference. They take no responsibility for any errors in the file and welcome feedback to correct any mistakes. Readers are asked to contact the author via email if they find any inaccuracies.
The document provides an introduction to the Microsoft .NET framework. It discusses that .NET is a development platform and runtime environment that includes a virtual machine, common language runtime, and class libraries. It supports building applications for web, Windows desktop, services and more using languages like C#. The .NET framework provides a consistent programming model, code execution environment, and class libraries to simplify development.
The document discusses the seven pillars of ASP.NET that differentiate it from previous web development platforms. These pillars include: 1) ASP.NET being integrated with the .NET Framework; 2) ASP.NET being compiled rather than interpreted; 3) ASP.NET being multilanguage; 4) ASP.NET being hosted by the Common Language Runtime; 5) ASP.NET being object-oriented; and 6) ASP.NET supporting all browsers. The document provides details on each pillar to explain the advantages ASP.NET provides to web developers.
The document provides an overview of the Visual Studio integrated development environment (IDE). It describes popular Visual Studio features like IntelliSense, code cleanup, refactoring, and debugging tools. It also explains how to install Visual Studio, create a simple "Hello World" console app project, add and run code to prompt for a user's name and display a greeting, and view the output in the console window.
The document discusses the seven pillars of ASP.NET that differentiated it from previous web development platforms when it was first released. These pillars include: 1) ASP.NET being integrated with the .NET Framework; 2) ASP.NET applications being compiled instead of interpreted; 3) ASP.NET being multilanguage; 4) ASP.NET being hosted by the Common Language Runtime; 5) ASP.NET being object-oriented; 6) ASP.NET supporting all browsers; and 7) ASP.NET having a stateful programming model.
This document provides an introduction and overview of VB.NET (Visual Basic .NET). It discusses what VB.NET is, its features, why it is used as a professional language, advantages and disadvantages. It also describes the structure of a VB.NET program, including namespaces, classes, modules, procedures, variables, and the main procedure. It explains the compilation and execution process of a VB.NET program in Visual Studio. An example VB.NET "Hello World" program is provided to demonstrate the core components.
The document discusses the introduction and history of .NET technology and Visual Basic .NET (VB.NET). It provides details on:
- The .NET framework which provides a development framework for building applications and web services.
- VB.NET which is a programming language that targets the .NET framework and is a successor to Visual Basic 6. It discusses the various versions of VB.NET released.
- Features of .NET such as interoperability, common language runtime, language independence, security and portability.
- The evolution of software development approaches from procedure-oriented to structure-oriented to object-oriented.
An automatic answer checker application compares student answers to exam questions against original answers stored by an administrator to allocate marks. The system uses artificial intelligence to evaluate subjective answers similarly to a human. Administrators can create questions and answers that are stored in a database. Students can take tests by typing their answers, which are then compared to the original answers to determine marks.
This document contains a summary of questions that are commonly asked during .NET interviews. The author collected material from various websites to compile it into a single file for reference. They take no responsibility for any errors in the file and welcome feedback to correct any mistakes. Readers are asked to contact the author via email if they find any inaccuracies.
The document provides an introduction to the .NET framework. It discusses that .NET is a software framework developed by Microsoft that includes a virtual machine (CLR) that compiles and executes programs written in different languages like C#, VB, and C++. It then summarizes some of the key features and components of the .NET framework like language integration, automatic memory management via garbage collection, and its support for building different types of applications.
this presentation is prepared by me to intrduce to the students the main features in .net frameworks .. it's a part of Software engineering course's projects i depend on Microsoft website wish you find it useful :)
The document describes an online advertising management system project developed in ASP.NET with C# and MS SQL. The system allows an advertising agency to organize tasks like managing customer information, advertising orders, and employee details through different modules. It aims to automate processes like order management, billing, and ad creation to save time and improve customer service over a manual system.
The document describes an online advertising management system project developed in ASP.NET with C# and SQL Server. The system has four main modules: Administrator, Front Office Staff, Ad Creator, and User. The Administrator module manages employee, customer, and billing details. The Front Office module handles order processing. The Ad Creator module creates ads after orders are received. The User module allows users to track order status and pay bills. The system aims to automate tasks like order processing currently done manually in advertising agencies to save time and improve customer service.
This document provides an overview of the .NET framework, including its history, components, tools, and key concepts like assemblies and garbage collection. It discusses what .NET is, when it was announced, its different versions, supported operating systems, development tools, intermediate language, programming languages like C#, and managed vs unmanaged code. It also covers assemblies, versioning, application domains, hosting .NET applications, and deterministic object destruction.
ASP.Net is a web development platform that provides a programming model, infrastructure, and services for building robust web applications. It uses HTTP to enable two-way communication between a browser and server. ASP.Net applications are compiled code written in languages like C# and VB.Net that can use classes in the .Net framework. The ASP.Net lifecycle involves initializing and loading pages, handling events, rendering output, and unloading pages. Key stages include initialization, loading, validation, handling postback events, and rendering.
Visual Studio .NET IDE is a customizable development environment for building .NET applications. It provides a single interface for developing all types of .NET projects using customizable toolbars and windows for code editing, debugging, and viewing solutions. Key features include support for multiple programming languages, a built-in browser, and windows for viewing solutions, properties, output, and more.
The document provides an introduction to programming basics and Visual Basic.NET (VB.NET), describing what a computer program and programming language are, and giving an overview of the VB.NET integrated development environment (IDE) and how to create a simple "Hello World" application in VB.NET. It explains that VB.NET is an object-oriented programming language designed by Microsoft for beginners to create Windows, web, and mobile applications.
Dot net-interview-questions-and-answers part iRakesh Joshi
.NET Framework is a complete environment that allows developers to develop, run, and deploy the following applications: Console applications,Windows Forms applications,Windows Presentation Foundation (WPF) applications,Web applications (ASP.NET applications),Web services,Windows services,Service-oriented applications using Windows Communication Foundation (WCF),Workflow-enabled applications using Windows Workflow Foundation (WF).
.NET Framework also enables a developer to create sharable components to be used in distributed computing architecture. NET Framework supports the object-oriented programming model for multiple languages, such as Visual Basic, Visual C#, and Visual C++. .NET Framework supports multiple programming languages in a manner that allows language interoperability. This implies that each language can use the code written in some other language.
Dot net-interview-questions-and-answers part iRakesh Joshi
.NET is a general-purpose software development platform, similar to Java. At its core is a virtual machine that turns intermediate language (IL) into machine code. High-level language compilers for C#, VB.NET and C++ are provided to turn source code into IL. C# is a new programming language, very similar to Java. An extensive class library is included, featuring all the functionality one might expect from a contempory development platform - windows GUI development (Windows Form s), database access (ADO.NET), web development (ASP.NET), web services, XML etc.
What is Computer Programming?
What is Software Development and Its Major Activities
Your First C# Program
Formatting the Program Source Code
The C# Language and .NET Framework
Microsoft Visual Studio: Compiling, Running and Debugging C# Programs
MSDN Library – The Integrated Help System in Visual Studio
Exercises: Creating, Compiling and Running C# Programs
This document provides an overview of Visual Basic, an integrated development environment (IDE) that allows programmers to develop graphical user interface (GUI) applications for Windows. Visual Basic uses a drag-and-drop interface to arrange controls on forms and allows programmers to write code to add functionality. The document discusses the history and evolution of Visual Basic, the core components of a Visual Basic application like forms and controls, and the basic steps to develop an application in Visual Basic.
Satish Marwat collected questions from various websites to create a single document for .NET interview preparation. The document contains questions about .NET frameworks, tools, terminology, assemblies and other topics. Satish provided his email for feedback on any mistakes and wants to ensure the material is accurate.
This document contains questions that are commonly asked during .NET interviews. It was compiled by Satish Marwat from various websites on the internet. The document covers topics like .NET framework versions, tools for .NET development like Visual Studio, terminology like CLI, CLR, IL, C#, managed code, assemblies, application domains, and garbage collection. The author provides their email for feedback on any mistakes in the document.
This document provides an introduction to a course on interactive application development using .NET Framework and C#. It outlines the course objectives, which are to develop interactive and GUI applications. The document discusses the prerequisites for the course, the lecture plan, grading scheme, and languages and tools that will be used, including Visual Studio IDE and C#. It provides an overview of .NET Framework, its architecture including Common Language Runtime and class library. It also discusses some basic concepts like arrays in C# with examples.
.NET is a development framework created by Microsoft that allows developers to easily create applications. It provides libraries and functionality that developers commonly use. .NET supports multiple programming languages and allows programs written in different languages to interact. Code written for .NET executes within the Common Language Runtime (CLR) environment, which handles tasks like memory management, security, and interoperability to make development easier.
This document introduces Visual Studio 2012 and .NET Framework 4.5. Visual Studio 2012 is an integrated development environment from Microsoft that supports development of applications across multiple languages. New features in Visual Studio 2012 include support for Windows Store applications, improved responsiveness through asynchronous operations, and ribbon controls in WPF. .NET Framework 4.5 enhances parallel computing capabilities and supports asynchronous read/write of HTTP requests and responses. Visual Studio 2012 editions range from the free Express edition to paid Professional, Premium, and Ultimate editions.
.NET is an open-source development platform from Microsoft that allows developers to build applications for Windows, web, and mobile. It provides a common language runtime and framework for building applications using multiple languages like C#, F#, and Visual Basic. The .NET framework handles tasks like memory management, security, and code execution. It includes class libraries for tasks like data access, user interfaces, and web development. Code written for .NET is compiled into an intermediate language called IL that can run on any system with the .NET runtime.
This document provides an overview of Windows Programming using Microsoft Visual Basic 6.0. It discusses the key elements of the Visual Basic Integrated Development Environment including the menu bar, toolbar, toolbox, form designer, properties window, and code editor window. It then provides two programming examples: 1) Designing a form to display a user's full name when a button is clicked. 2) Creating an application using data types, variants, and arrays in Visual Basic. The document concludes with an example of designing a login page that displays different messages based on entering the correct or incorrect username and password.
If you want to develop web based, desktop or mobile applications using ASP, then Visual Studio .NET is the place for you. It provides a complete set of developmental tools for developing the various applications.
The document provides an introduction to the .NET framework. It discusses that .NET is a software framework developed by Microsoft that includes a virtual machine (CLR) that compiles and executes programs written in different languages like C#, VB, and C++. It then summarizes some of the key features and components of the .NET framework like language integration, automatic memory management via garbage collection, and its support for building different types of applications.
this presentation is prepared by me to intrduce to the students the main features in .net frameworks .. it's a part of Software engineering course's projects i depend on Microsoft website wish you find it useful :)
The document describes an online advertising management system project developed in ASP.NET with C# and MS SQL. The system allows an advertising agency to organize tasks like managing customer information, advertising orders, and employee details through different modules. It aims to automate processes like order management, billing, and ad creation to save time and improve customer service over a manual system.
The document describes an online advertising management system project developed in ASP.NET with C# and SQL Server. The system has four main modules: Administrator, Front Office Staff, Ad Creator, and User. The Administrator module manages employee, customer, and billing details. The Front Office module handles order processing. The Ad Creator module creates ads after orders are received. The User module allows users to track order status and pay bills. The system aims to automate tasks like order processing currently done manually in advertising agencies to save time and improve customer service.
This document provides an overview of the .NET framework, including its history, components, tools, and key concepts like assemblies and garbage collection. It discusses what .NET is, when it was announced, its different versions, supported operating systems, development tools, intermediate language, programming languages like C#, and managed vs unmanaged code. It also covers assemblies, versioning, application domains, hosting .NET applications, and deterministic object destruction.
ASP.Net is a web development platform that provides a programming model, infrastructure, and services for building robust web applications. It uses HTTP to enable two-way communication between a browser and server. ASP.Net applications are compiled code written in languages like C# and VB.Net that can use classes in the .Net framework. The ASP.Net lifecycle involves initializing and loading pages, handling events, rendering output, and unloading pages. Key stages include initialization, loading, validation, handling postback events, and rendering.
Visual Studio .NET IDE is a customizable development environment for building .NET applications. It provides a single interface for developing all types of .NET projects using customizable toolbars and windows for code editing, debugging, and viewing solutions. Key features include support for multiple programming languages, a built-in browser, and windows for viewing solutions, properties, output, and more.
The document provides an introduction to programming basics and Visual Basic.NET (VB.NET), describing what a computer program and programming language are, and giving an overview of the VB.NET integrated development environment (IDE) and how to create a simple "Hello World" application in VB.NET. It explains that VB.NET is an object-oriented programming language designed by Microsoft for beginners to create Windows, web, and mobile applications.
Dot net-interview-questions-and-answers part iRakesh Joshi
.NET Framework is a complete environment that allows developers to develop, run, and deploy the following applications: Console applications,Windows Forms applications,Windows Presentation Foundation (WPF) applications,Web applications (ASP.NET applications),Web services,Windows services,Service-oriented applications using Windows Communication Foundation (WCF),Workflow-enabled applications using Windows Workflow Foundation (WF).
.NET Framework also enables a developer to create sharable components to be used in distributed computing architecture. NET Framework supports the object-oriented programming model for multiple languages, such as Visual Basic, Visual C#, and Visual C++. .NET Framework supports multiple programming languages in a manner that allows language interoperability. This implies that each language can use the code written in some other language.
Dot net-interview-questions-and-answers part iRakesh Joshi
.NET is a general-purpose software development platform, similar to Java. At its core is a virtual machine that turns intermediate language (IL) into machine code. High-level language compilers for C#, VB.NET and C++ are provided to turn source code into IL. C# is a new programming language, very similar to Java. An extensive class library is included, featuring all the functionality one might expect from a contempory development platform - windows GUI development (Windows Form s), database access (ADO.NET), web development (ASP.NET), web services, XML etc.
What is Computer Programming?
What is Software Development and Its Major Activities
Your First C# Program
Formatting the Program Source Code
The C# Language and .NET Framework
Microsoft Visual Studio: Compiling, Running and Debugging C# Programs
MSDN Library – The Integrated Help System in Visual Studio
Exercises: Creating, Compiling and Running C# Programs
This document provides an overview of Visual Basic, an integrated development environment (IDE) that allows programmers to develop graphical user interface (GUI) applications for Windows. Visual Basic uses a drag-and-drop interface to arrange controls on forms and allows programmers to write code to add functionality. The document discusses the history and evolution of Visual Basic, the core components of a Visual Basic application like forms and controls, and the basic steps to develop an application in Visual Basic.
Satish Marwat collected questions from various websites to create a single document for .NET interview preparation. The document contains questions about .NET frameworks, tools, terminology, assemblies and other topics. Satish provided his email for feedback on any mistakes and wants to ensure the material is accurate.
This document contains questions that are commonly asked during .NET interviews. It was compiled by Satish Marwat from various websites on the internet. The document covers topics like .NET framework versions, tools for .NET development like Visual Studio, terminology like CLI, CLR, IL, C#, managed code, assemblies, application domains, and garbage collection. The author provides their email for feedback on any mistakes in the document.
This document provides an introduction to a course on interactive application development using .NET Framework and C#. It outlines the course objectives, which are to develop interactive and GUI applications. The document discusses the prerequisites for the course, the lecture plan, grading scheme, and languages and tools that will be used, including Visual Studio IDE and C#. It provides an overview of .NET Framework, its architecture including Common Language Runtime and class library. It also discusses some basic concepts like arrays in C# with examples.
.NET is a development framework created by Microsoft that allows developers to easily create applications. It provides libraries and functionality that developers commonly use. .NET supports multiple programming languages and allows programs written in different languages to interact. Code written for .NET executes within the Common Language Runtime (CLR) environment, which handles tasks like memory management, security, and interoperability to make development easier.
This document introduces Visual Studio 2012 and .NET Framework 4.5. Visual Studio 2012 is an integrated development environment from Microsoft that supports development of applications across multiple languages. New features in Visual Studio 2012 include support for Windows Store applications, improved responsiveness through asynchronous operations, and ribbon controls in WPF. .NET Framework 4.5 enhances parallel computing capabilities and supports asynchronous read/write of HTTP requests and responses. Visual Studio 2012 editions range from the free Express edition to paid Professional, Premium, and Ultimate editions.
.NET is an open-source development platform from Microsoft that allows developers to build applications for Windows, web, and mobile. It provides a common language runtime and framework for building applications using multiple languages like C#, F#, and Visual Basic. The .NET framework handles tasks like memory management, security, and code execution. It includes class libraries for tasks like data access, user interfaces, and web development. Code written for .NET is compiled into an intermediate language called IL that can run on any system with the .NET runtime.
This document provides an overview of Windows Programming using Microsoft Visual Basic 6.0. It discusses the key elements of the Visual Basic Integrated Development Environment including the menu bar, toolbar, toolbox, form designer, properties window, and code editor window. It then provides two programming examples: 1) Designing a form to display a user's full name when a button is clicked. 2) Creating an application using data types, variants, and arrays in Visual Basic. The document concludes with an example of designing a login page that displays different messages based on entering the correct or incorrect username and password.
If you want to develop web based, desktop or mobile applications using ASP, then Visual Studio .NET is the place for you. It provides a complete set of developmental tools for developing the various applications.
Similar to Unit -II Introduction to visual programming.pdf (20)
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...TechSoup
Whether you're new to SEO or looking to refine your existing strategies, this webinar will provide you with actionable insights and practical tips to elevate your nonprofit's online presence.
How to Setup Warehouse & Location in Odoo 17 InventoryCeline George
In this slide, we'll explore how to set up warehouses and locations in Odoo 17 Inventory. This will help us manage our stock effectively, track inventory levels, and streamline warehouse operations.
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.pptHenry Hollis
The History of NZ 1870-1900.
Making of a Nation.
From the NZ Wars to Liberals,
Richard Seddon, George Grey,
Social Laboratory, New Zealand,
Confiscations, Kotahitanga, Kingitanga, Parliament, Suffrage, Repudiation, Economic Change, Agriculture, Gold Mining, Timber, Flax, Sheep, Dairying,
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...EduSkills OECD
Andreas Schleicher, Director of Education and Skills at the OECD presents at the launch of PISA 2022 Volume III - Creative Minds, Creative Schools on 18 June 2024.
How Barcodes Can Be Leveraged Within Odoo 17Celine George
In this presentation, we will explore how barcodes can be leveraged within Odoo 17 to streamline our manufacturing processes. We will cover the configuration steps, how to utilize barcodes in different manufacturing scenarios, and the overall benefits of implementing this technology.
This presentation was provided by Rebecca Benner, Ph.D., of the American Society of Anesthesiologists, for the second session of NISO's 2024 Training Series "DEIA in the Scholarly Landscape." Session Two: 'Expanding Pathways to Publishing Careers,' was held June 13, 2024.
Chapter wise All Notes of First year Basic Civil Engineering.pptxDenish Jangid
Chapter wise All Notes of First year Basic Civil Engineering
Syllabus
Chapter-1
Introduction to objective, scope and outcome the subject
Chapter 2
Introduction: Scope and Specialization of Civil Engineering, Role of civil Engineer in Society, Impact of infrastructural development on economy of country.
Chapter 3
Surveying: Object Principles & Types of Surveying; Site Plans, Plans & Maps; Scales & Unit of different Measurements.
Linear Measurements: Instruments used. Linear Measurement by Tape, Ranging out Survey Lines and overcoming Obstructions; Measurements on sloping ground; Tape corrections, conventional symbols. Angular Measurements: Instruments used; Introduction to Compass Surveying, Bearings and Longitude & Latitude of a Line, Introduction to total station.
Levelling: Instrument used Object of levelling, Methods of levelling in brief, and Contour maps.
Chapter 4
Buildings: Selection of site for Buildings, Layout of Building Plan, Types of buildings, Plinth area, carpet area, floor space index, Introduction to building byelaws, concept of sun light & ventilation. Components of Buildings & their functions, Basic concept of R.C.C., Introduction to types of foundation
Chapter 5
Transportation: Introduction to Transportation Engineering; Traffic and Road Safety: Types and Characteristics of Various Modes of Transportation; Various Road Traffic Signs, Causes of Accidents and Road Safety Measures.
Chapter 6
Environmental Engineering: Environmental Pollution, Environmental Acts and Regulations, Functional Concepts of Ecology, Basics of Species, Biodiversity, Ecosystem, Hydrological Cycle; Chemical Cycles: Carbon, Nitrogen & Phosphorus; Energy Flow in Ecosystems.
Water Pollution: Water Quality standards, Introduction to Treatment & Disposal of Waste Water. Reuse and Saving of Water, Rain Water Harvesting. Solid Waste Management: Classification of Solid Waste, Collection, Transportation and Disposal of Solid. Recycling of Solid Waste: Energy Recovery, Sanitary Landfill, On-Site Sanitation. Air & Noise Pollution: Primary and Secondary air pollutants, Harmful effects of Air Pollution, Control of Air Pollution. . Noise Pollution Harmful Effects of noise pollution, control of noise pollution, Global warming & Climate Change, Ozone depletion, Greenhouse effect
Text Books:
1. Palancharmy, Basic Civil Engineering, McGraw Hill publishers.
2. Satheesh Gopi, Basic Civil Engineering, Pearson Publishers.
3. Ketki Rangwala Dalal, Essentials of Civil Engineering, Charotar Publishing House.
4. BCP, Surveying volume 1
1. BSc. Sem V
Paper-5S-. Net Technology and Java Programming
UNIT II
The .NET Framework and the Common Language Runtime
VB .NET is only one component of a revolution in Windows-the .NET framework. This
framework provides the new support for software development and operating system support
in Windows, and it's more extensive than anything we've seen in Windows before. The .NET
framework wraps the operating system with its own code, and your VB .NET programs actually
deal with .NET code instead of dealing with the operating system itself. And it is specially
designed to make working with the Internet easy.
At the base of the .NET framework is the Common Language Runtime (CLR). The
CLR is the module that actually runs your VB .NET applications. When you create a VB .NET
application, what really happens is that your code is compiled into the CLR's Intermediate
Language (named MSIL, or IL for short), much like bytecodes in Java.
When you run the application, that IL code is translated into the binary code your computer
can understand by some special compilers built into the CLR. Compilers translate your code
into something that your machine's hardware, or other software, can deal with directly. In this
way, Microsoft can one day create a CLR for operating systems other than Windows, and your
VB .NET applications, compiled into IL, will run on them.
The .NET Framework class library is the second major part of the .NET framework. The class
library holds an immense amount of prewritten code that all the applications you create with
Visual Basic, Visual C++, C#, and other Visual Studio languages build on.
The class library gives your program the support it needs-for example, your program may
create several forms, and as there is a class for forms in the class library, your program doesn't
have to perform all the details of creating those forms from scratch. All your code has to do is
declare a new form, and the CLR compilers can get the actual code that supports forms from
the .NET Framework class library. In this way, your programs can be very small compared to
earlier Windows applications; because you can rely on the millions of lines of code already
written in the class library, not everything has to be in your application's executable (EXE) file.
All this assumes that you're working on a machine that has the .NET framework, and therefore
the CLR and the .NET Framework class library, installed. The code for all elements we use in
a VB .NET application-forms, buttons, menus, and all the rest-all comes from the class library.
And other Visual Studio applications use the same class library, making it easy to mix
languages in your programming, even in the same application. Also, distributing applications
is easier, because all the support you need is already on the machine you're installing your
application to.
As mentioned, the .NET framework organizes its classes into namespaces. For example, the
.NET framework includes the namespaces Microsoft.VisualBasic, Microsoft.JScript,
Microsoft.CSharp, and Microsoft.Win32. In fact, these namespaces contain relatively few
classes; the real way we'll interact with the .NET framework class library in this book is through
the System namespace.
2. The System Namespaces
When you want to use a Windows form, for example, you must use the
System.Windows.Forms. Form class. A button in a Windows form comes from the
System.Windows. Forms.Button class, and so on. There are many such classes, organized
into various namespaces like System.Windows.Forms.
Building VB .NET Applications
To build applications in VB .NET, we have to get some terminology under our belts, because
the .NET framework requires a new structure for applications. In particular, assemblies are
now the building blocks of the .NET Framework; they form the fundamental unit of
deployment, version control, reuse, security permissions, and more.
An assembly provides the CLR with the information and compiled code it needs to know how
to run your code, much as EXE files did for Windows in VB6.
Assemblies
You combine assemblies to form .NET applications, and although we won't deal with them
directly very often, we need to get the terminology down. An assembly holds the Intermediate
Language modules for your application. When you create an application in
VB .NET and run it, VB .NET creates one or more assemblies, which are run by the CLR. That
is, assemblies are how your applications interact with the .NET framework instead of the EXE
or DLL files of VB6.
The Visual Basic Integrated Development Environment
The IDE, shown in the following Figure, has become more complex than in previous versions
of Visual Basic, and being able to use it, or at least knowing what the various parts are called.
Part of the reasons it's become more complex is that the same IDE is now shared by all Visual
Studio languages, such as VB and C#.
Visual Studio is a powerful and customizable programming environment that contains all the
tools you need to build programs quickly and efficiently. It offers a set of tools that help you
write and modify the code for your programs, and also detect and correct errors in your
programs.
Before you start learning more about VB.NET programming, it is important to understand the
development environment and identify some of the frequently using programming tools in
Visual Studio IDE.
3. Fig:The Visual Basic Integrated Development Environment.
1. Menu Bar
2. Standard Toolbar
3. ToolBox
4. Forms Designer
5. Output Window
6. Solution Explorer
7. Properties Window
File Menu
You can use the file menu to save or open your vb.net project, edit, find and replace text. You
can also use the View Menu to display the toolbox or solutions explorer if they are not visible.
The project menu is used to add new forms, classes or modules.
Tool bar
The tool bar contains different shortcuts for opening/saving projects as well as running your
project once it is ready for debugging.
Status Bar
It appears on the bottom of the vb.net IDE. It displays the status of the current operation. By
default, it will display a “Ready” status but this will change once your run the application.
Solutions explorer
The solutions explorer appears at the right-most part of the vb.net IDE. It displays all the objects
that you are using on your project including your forms, datasets, reports, modules, references
and different resources that you have used on your project
Tool box
4. The vb.net tool box displays different visual objects/tools that you can use on your form. The
most common tools include:
● Label
● Textbox
● Command Button
● Radio button
● Checkbox
● Listbox
● Combo box
● Picture box
● Date & Time Picker and
● Progress Bar
Visual Basic.NET IDE is built out of a collection of different windows. Some windows are
used for writing code, some for designing interfaces, and others for getting a general overview
of files or classes in your application.
Visual Studio organizes your work in projects and solutions. A solution can contain more than
one project, such as a DLL and an executable that references that DLL. From the following
chapters you will learn how to use these Visual Studio features for your programming needs.
Console application
Console applications are light weight programs run inside the command prompt (DOS)
window. They are commonly used for test applications. Console Applications don't have
graphical user interfaces and are run in the Command Prompt. It is text based code editor
window. Windows Forms applications do have user interfaces.
In Visual Studio 2010 you can start Console Application project as follows:
File>New Project>Console Application
5. Windows Application
Windows *Forms* (WinForms) is the name given to the graphical application programming
interface (API) included as a part of Microsoft .NET Framework, providing access to native
Microsoft Windows interface elements by wrapping the extant Windows API in managed code.
Windows Applications are form based standard Windows desktop applications for common
day to day tasks. Microsoft word is an example of a Windows application.
A Windows form application is an application that has a graphical user interface(GUI) like the
Visual C# IDE. A console program on the other hand is a text application. There are not fancy
controls like buttons or textboxes in a console application and they are run from the command
prompt.
In Visual Studio 2010 you can start Console Application project as follows:
File>New Project>Windows Form Application
Visual Basic Statements
A Visual Basic statement is a complete instruction. It can contain:
keywords—Words reserved for Visual Basic's use.
operators—Symbols used to perform operations, like +, which performs addition and so on.
variables—Symbolic names given to values stored in memory and declared with the Dim
keyword.
constants—The same as variables, except that constants are assigned a value that cannot then
be altered.
expressions—Combinations of terms and/or keywords that yield a value. For example, if the
variable temperature holds the value 72, then the expression temperature + 3 yields the value
75.
Each statement is one of the following:
● A declaration statement, which can name and create a variable, constant, or procedure
and can also specify a data type.
● An executable statement, which can perform an action.
The Visual Basic Keywords
6. As with all programming languages, Visual Basic is built using keywords. These keywords are
reserved for use by Visual Basic, and you use them to build your programs.
Table: The Visual Basic keywords.
Keyword Description
AddHandler Visual Basic .NET Statement
AddressOf Visual Basic .NET Statement
Alias Used in the Declare statement
And Boolean operator
AndAlso Boolean operator
Ansi Used in the Declare statement
Append Used as a symbolic constant in the FileOpen function
As Used in variable declaration (Dim, Friend, etc.)
Assembly Assembly-level attribute specifier
Auto Used in the Declare statement
Binary Used in the Option Compare statement
Boolean Used in variable declaration (intrinsic data type)
ByRef Used in argument lists
Byte Used in variable declaration (intrinsic data type)
7. ByVal Used in argument lists
Call Visual Basic .NET statement
Case Used in the Select Case construct
Catch Visual Basic .NET statement
CBool Data-conversion function
CByte Data-conversion function
CChar Data-conversion function
CDate Data-conversion function
CDec Data-conversion function
CDbl Data-conversion function
Char Used in variable declaration (intrinsic data type)
CInt Data-conversion function
8. Class Visual Basic .NET statement
CLng Data-conversion function
Data Types Available in VB.Net
VB.Net provides a wide range of data types. The following table shows all the data types
available −
Data Type Storage Allocation Value Range
Boolean Depends on
implementing
platform
True or False
Byte 1 byte 0 through 255 (unsigned)
Char 2 bytes 0 through 65535 (unsigned)
Date 8 bytes 0:00:00 (midnight) on January 1, 0001 through
11:59:59 PM on December 31, 9999
Decimal 16 bytes 0 through +/-
79,228,162,514,264,337,593,543,950,335 (+/-
7.9...E+28) with no decimal point; 0 through +/-
7.9228162514264337593543950335 with 28
places to the right of the decimal
9. Double 8 bytes
-1.79769313486231570E+308 through -
4.94065645841246544E-324, for negative
values
4.94065645841246544E-324 through
1.79769313486231570E+308, for positive
values
Integer 4 bytes -2,147,483,648 through 2,147,483,647 (signed)
Long 8 bytes -9,223,372,036,854,775,808 through
9,223,372,036,854,775,807(signed)
Object
4 bytes on 32-bit
platform
8 bytes on 64-bit
platform
Any type can be stored in a variable of type
Object
SByte 1 byte -128 through 127 (signed)
Short 2 bytes -32,768 through 32,767 (signed)
Single 4 bytes
-3.4028235E+38 through -1.401298E-45 for
negative values;
1.401298E-45 through 3.4028235E+38 for
positive values
10. String Depends on
implementing
platform
0 to approximately 2 billion Unicode characters
UInteger 4 bytes 0 through 4,294,967,295 (unsigned)
ULong 8 bytes 0 through 18,446,744,073,709,551,615
(unsigned)
User-Defined Depends on
implementing
platform
Each member of the structure has a range
determined by its data type and independent of
the ranges of the other members
UShort 2 bytes 0 through 65,535 (unsigned)
Declaring Variables
A variable is nothing but a name given to a storage area that our programs can manipulate.
Each variable in VB.Net has a specific type, which determines the size and layout of the
variable's memory; the range of values that can be stored within that memory; and the set of
operations that can be applied to the variable.
Unlike VB6 and earlier versions of Visual Basic, you must declare all variables before
using them by default in VB .NET. Variable Declaration in VB.Net
The Dim statement is used for variable declaration and storage allocation for one or more
variables. The Dim statement is used at module, class, structure, procedure or block level.
Syntax for variable declaration in VB.Net is :
[ < attributelist > ] [ accessmodifier ] [[ Shared ] [ Shadows ] | [ Static ]] [ ReadOnly ] Dim [
WithEvents ] variablelist
Where,
● attributelist is a list of attributes that apply to the variable. Optional.
● accessmodifier defines the access levels of the variables, it has values as - Public,
Protected, Friend, Protected Friend and Private. Optional.
● Shared declares a shared variable, which is not associated with any specific instance of
a class or structure, rather available to all the instances of the class or structure.
Optional.
11. ● Shadows indicate that the variable re-declares and hides an identically named element,
or set of overloaded elements, in a base class. Optional.
● Static indicates that the variable will retain its value, even when the after termination
of the procedure in which it is declared. Optional.
● ReadOnly means the variable can be read, but not written. Optional.
● WithEvents specifies that the variable is used to respond to events raised by the instance
assigned to the variable. Optional.
● Variablelist provides the list of variables declared.
accessmodifier are:
Public—Gives variables public access, which means there are no restrictions on their
accessibility. You can use Public only at module, namespace, or file level (which means you
can't use it inside a procedure). Note that if you specify Public, you can omit the Dim keyword
if you want to.
Protected—Gives variables protected access, which means they are accessible only from
within their own class or from a class derived from that class. You can use Protected only at
class level (which means you can't use it inside a procedure), because you use it to declare
members of a class. Note that if you specify Protected, you can omit the Dim keyword if you
want to.
Friend—Gives variables friend access, which means they are accessible from within the
program that contains their declaration, as well as from anywhere else in the same assembly.
You can use Friend only at module, namespace, or file level (which means you can't use it
inside a procedure). Note that if you specify Friend, you can omit the Dim keyword if you
want to.
Protected Friend—Gives variables both protected and friend access, which means they can
be used by code in the same assembly, as well as by code in derived classes.
Private—Gives variables private access, which means they are accessible only from within
their declaration context (usually a class), including any nested procedures. You can use
Private only at module, namespace, or file level (which means you can't use it inside a
procedure). Note that if you specify Private, you
can omit the Dim keyword if you want to.
Each variable in the variable list has the following syntax and parts −
variablename[([ boundslist])] [ As [ New ] datatype ] [ = initializer ]
Where,
● variablename − is the name of the variable
● boundslist − optional. It provides a list of bounds of each dimension of an array variable.
● New − optional. It creates a new instance of the class when the Dim statement runs.
● datatype − Required if Option Strict is On. It specifies the data type of the variable.
● initializer − Optional if New is not specified. Expression that is evaluated and assigned
to the variable when it is created.
Some valid variable declarations along with their definition are shown here −
Dim StudentID As Integer
Dim StudentName As String
Dim Salary As Double
12. Dim count1, count2 As Integer
Dim status As Boolean
Dim exitButton As New System.Windows.Forms.Button
Dim lastTime, nextTime As Date
Variable Initialization in VB.Net
Variables are initialized (assigned a value) with an equal sign followed by a constant
expression. The general form of initialization is −
variable_name = value;
for example,
Dim pi As Double
pi = 3.14159
You can initialize a variable at the time of declaration as follows −
Dim StudentID As Integer = 100
Dim StudentName As String = "Bill Smith"
Example
Try the following example which makes use of various types of variables −
Module variablesNdataypes
Sub Main()
Dim a As Short
Dim b As Integer
Dim c As Double
a = 10
b = 20
c = a + b
Console.WriteLine("a = {0}, b = {1}, c = {2}", a, b, c)
Console.ReadLine()
End Sub
End Module
When the above code is compiled and executed, it produces the following result −
a = 10, b = 20, c = 30
Accepting Values from User
The Console class in the System namespace provides a function ReadLine for accepting input
from the user and store it into a variable. For example,
Dim message As String
message = Console.ReadLine
The following example demonstrates it −
Module variablesNdataypes
13. Sub Main()
Dim message As String
Console.Write("Enter message: ")
message = Console.ReadLine
Console.WriteLine()
Console.WriteLine("Your Message: {0}", message)
Console.ReadLine()
End Sub
End Module
When the above code is compiled and executed, it produces the following result (assume the
user inputs Hello World) −
Enter message: Hello World
Your Message: Hello World
Example
The following example demonstrates use of some of the types −
Module DataTypes
Sub Main()
Dim b As Byte
Dim n As Integer
Dim si As Single
Dim d As Double
Dim da As Date
Dim c As Char
Dim s As String
Dim bl As Boolean
b = 1
n = 1234567
si = 0.12345678901234566
d = 0.12345678901234566
da = Today
c = "U"c
s = "Me"
If ScriptEngine = "VB" Then
bl = True
Else
bl = False
End If
If bl Then
'the oath taking
Console.Write(c & " and," & s & vbCrLf)
Console.WriteLine("declaring on the day of: {0}", da)
Console.WriteLine("We will learn VB.Net seriously")
Console.WriteLine("Lets see what happens to the floating point variables:")
Console.WriteLine("The Single: {0}, The Double: {1}", si, d)
End If
Console.ReadKey()
14. End Sub
End Module
When the above code is compiled and executed, it produces the following result −
U and, Me
declaring on the day of: 12/4/2012 12:00:00 PM
We will learn VB.Net seriously
Lets see what happens to the floating point variables:
The Single:0.1234568, The Double: 0.123456789012346
Scope of Variable in VB.NET
The scope of a variable is where its value is kept, and can be referred to in the code. The
scope of a variable determines the accessible range of a defined variable at the time of
declaration in any block, module, and class. You can access it if the variable is in a particular
region or scope in the same block. And if the variable goes beyond the region, its scope
expires.
The following are the methods to represent the scope of a variable in VB.NET.
1. Procedure Scope
2. Module Scope
3. Public Scope
Procedure (local) scope
A local variable is a type of variable defined within a procedure scope, block, or function. It
is available with a code inside the procedure, and it can be declared using the Dim or static
statement. These variables are not accessible from outside of the local method. However, the
local variable can be easily accessed by the nested programming function in the same method.
Ex: Dim X As Integer
Local variables exist until the procedure in which they are declared is executed. Once a
procedure is executed, the values of its local variables will be lost, and the resources used by
these variables will be released. And when the block is executed again, all the local variables
are rearranged.
Module Local_scope
Sub Main()
Console.WriteLine(" Scope of local varibale within a function")
local() ' call local() function without any object reference
Console.WriteLine("press any key to exit...")
Console.ReadKey()
End Sub
Sub local()
Dim X As Integer
15. X = 50
Console.WriteLine(" Value of Local value X is {0}", X)
End Sub
End Module
A local variable is a variable declared inside a Sub or Function. A local variables’ scope is its
enclosing block. It can be used from the Dim statement to the last statement of the enclosing
block.
Console.WriteLine(a) ' Compile error: "a" is declared after this statement.
Dim a As Integer = 10
And here is a program that cannot be compiled because the variable value is used outside of
its scope.
Do
Dim value As Integer = Console.ReadLine()
Loop While value <> -1 ' Compile error: "value" is not accessible
' here.
The program above can be corrected into one of the following:
Dim value As Integer
Do
value = Console.ReadLine()
Loop While value <> -1
Module Scope
A variable declared inside a module sheet is called a module-level variable. The defined
module variable is visible to all procedures within that module only, but it is not available for
other module's procedures.
The Dim or private statement at the top of the first procedure declaration can be declared the
module-level variables.
It means that these variables cannot be declared inside any procedure block. Further, these
variables are useful to share information between the procedures in the same module. And one
more thing about the module-level variable is that these variables can remains existence as long
as the module is executed.
Global (Public) Scope
As the name defines, a global variable is a variable that is used to access the variables globally
in a program.
These variables can be accessed by all the procedures or modules available in a program.
To access the variables globally in a program, you need to use the friend or public keyword
with a variable in a module or class at the top of the first procedure function.
16. Global scope is also known as the Namespace scope.
Module Global_scope1
Public str As String = "Hello, Programmer."
Public topic As String
Public exp As Integer
Sub Main()
Console.WriteLine(" You have passed {0}", str)
Console.WriteLine(" Enter the topic name")
topic = Console.ReadLine
Console.WriteLine(" Topic Name :{0}", topic)
Console.WriteLine("How many years of experienced in {0}?", topic)
exp = Console.ReadLine
Console.WriteLine(" Your Experienced is {0} ", exp)
Console.ReadKey()
End Sub
End Module
Operators and statements:
An operator is a symbol that tells the compiler to perform specific mathematical or logical
manipulations. VB.Net is rich in built-in operators and provides following types of commonly
used operators −
● Arithmetic Operators
● Comparison Operators
● Logical/Bitwise Operators
● Bit Shift Operators
● Assignment Operators
● Miscellaneous Operators
Visual Basic comes with plenty of built-in operators, which let you manipulate your data. For
example, adding the values in intVariable1 and intVariable2 with the addition operator, +, and
storing the result in intVariable3 with the assignment operator, =:
Module Module1
Sub Main()
Dim intVariable1 As Integer = 1234
Dim intVariable2 As Integer = 2345
Dim intVariable3 As Integer
intVariable3 = intVariable1 + intVariable2
System.Console.WriteLine(intVariable3)
End Sub
End Module
17. This code prints out the result of adding 1234 and 2345, which is 3579. An operator works on
operands; for example, in the expression 5 + 4, 5 is operand1,+ is the operator, and 4 is
operand2. Some operators in Visual Basic take two operands, and some take one.
There are various types of operators in Visual Basic, and I'll go over them all here. Here are
the Arithmetic operators (for example, the expression 5 + 4 yields a value of 9):
^ Exponentiation
* Multiplication
/ Division
Integer division
Mod Modulus
+ Addition
- Subtraction
Operator Description Example
^ Raises one operand to the power of another B^A will give 49
+ Adds two operands A + B will give 9
- Subtracts second operand from the first A - B will give -5
* Multiplies both operands A * B will give
14
/ Divides one operand by another and returns a floating
point result
B / A will give
3.5
Divides one operand by another and returns an integer
result
B A will give 3
MOD Modulus Operator and remainder of after an integer
division
B MOD A will
give 1
18. These are the Assignment operators (for example, temperature = 72 stores the value
72 in the variable temperature):
= Assignment
^= Exponentiation followed by assignment
*= Multiplication followed by assignment
/= Division followed by assignment
= Integer division followed by assignment
+= Addition followed by assignment
-= Subtraction followed by assignment
&= Concatenation followed by assignment
Conditional operators
< (Less than)—True if operand1 is less than operand2
<= (Less than or equal to)—True if operand1 is less than or equal to operand2
> (Greater than)—True if operand1 is greater than operand2
>= (Greater than or equal to)—True if operand1 is greater than or equal to
operand2
= (Equal to)—True if operand1 equals operand2
<> (Not equal to)—True if operand1 is not equal to operand2
Is—True if two object references refer to the same object
Like—Performs string pattern matching
Operator Description Example
= Checks if the values of two operands are equal or not;
if yes, then condition becomes true.
(A = B) is not
true.
<> Checks if the values of two operands are equal or not;
if values are not equal, then condition becomes true.
(A <> B) is true.
> Checks if the value of left operand is greater than the
value of right operand; if yes, then condition becomes
true.
(A > B) is not
true.
19. < Checks if the value of left operand is less than the
value of right operand; if yes, then condition becomes
true.
(A < B) is true.
>= Checks if the value of left operand is greater than or
equal to the value of right operand; if yes, then
condition becomes true.
(A >= B) is not
true.
<= Checks if the value of left operand is less than or
equal to the value of right operand; if yes, then
condition becomes true.
(A <= B) is true.
Module Module1
Sub Main()
Dim x As Integer = 11
Dim y As Integer = 5
If (x = y) Then
Console.WriteLine("11=5 is True")
Else
Console.WriteLine(" 11=5 is False")
End If
If (x < y) Then
Console.WriteLine(" 11<5 is True")
Else
Console.WriteLine(" 11<5 is False")
End If
If (x > y) Then
Console.WriteLine(" 11>5 is True")
Else
Console.WriteLine(" 11>5 is False")
End If
x = 3
y = 7
If (x <= y) Then
Console.WriteLine(" 3<=7 is True")
End If
If (y >= x) Then
Console.WriteLine(" 7>=3 is True")
End If
Console.ReadLine()
20. End Sub
End Module
Apart from the above, VB.Net provides three more comparison operators, which we will be
using in forthcoming chapters; however, we give a brief description here.
● Is Operator − It compares two object reference variables and determines if two object
references refer to the same object without performing value comparisons. If object1
and object2 both refer to the exact same object instance, result is True; otherwise, result
is False.
● IsNot Operator − It also compares two object reference variables and determines if two
object references refer to different objects. If object1 and object2 both refer to the exact
same object instance, result is False; otherwise, result is True.
● Like Operator − It compares a string against a pattern.
These are the String Concatenation operators (for example, "Hi "& " there " yields the
string "Hi there".):
& String concatenation
+ String concatenation
These are the Logical/Bitwise operators:
And— Performs an And operation (for logical operations: True if both operands
are True, False otherwise; the same for bit-by-bit operations where you treat 0
as False and 1 as True).
Not— Reverses the logical value of its operand, from True to False and False to True,
or bitwise operations, turns 0 into 1 and 1 into 0.
Or— Operator performs an Or operation (for logical operations: True if either
operand is True, False otherwise; the same for bit-by-bit operations where you treat 0
as False and 1 as True).
Xor— Operator performs an exclusive-Or operation (for logical operations:
True if either operand, but not both, is True, and False otherwise; the same for
bit-by-bit operations where you treat 0 as False and 1 as True).
AndAlso— Operator A "short circuited" And operator; if the first operand is
False, the second operand is not tested.
OrElse— Operator A "short circuited" Or operator, if the first operand is True,
the second is not tested.
Operator Description Example
21. And It is the logical as well as bitwise AND operator. If both the operands
are true, then condition becomes true. This operator does not perform
short-circuiting, i.e., it evaluates both the expressions.
(A And B) is
False.
Or It is the logical as well as bitwise OR operator. If any of the two
operands is true, then condition becomes true. This operator does not
perform short-circuiting, i.e., it evaluates both the expressions.
(A Or B) is
True.
Not It is the logical as well as bitwise NOT operator. Use to reverses the
logical state of its operand. If a condition is true, then Logical NOT
operator will make false.
Not(A And B)
is True.
Xor It is the logical as well as bitwise Logical Exclusive OR operator. It
returns True if both expressions are True or both expressions are False;
otherwise it returns False. This operator does not perform short-
circuiting, it always evaluates both expressions and there is no short-
circuiting counterpart of this operator.
A Xor B is
True.
AndAlso It is the logical AND operator. It works only on Boolean data. It
performs short-circuiting.
(A AndAlso B)
is False.
OrElse It is the logical OR operator. It works only on Boolean data. It
performs short-circuiting.
(A OrElse B) is
True.
IsFalse It determines whether an expression is False.
22. IsTrue It determines whether an expression is True.
Module Module1
Sub Main()
Dim var_w As Boolean = True
Dim var_x As Boolean = True
Dim var_y As Integer = 5
Dim var_z As Integer = 20
If (var_w And var_x) Then
Console.WriteLine("var_w And var_x - is true")
End If
If (var_w Or var_x) Then
Console.WriteLine("var_w Or var_x - is true")
End If
If (var_w Xor var_x) Then
Console.WriteLine("var_w Xor var_x - is true")
End If
If (var_y And var_z) Then
Console.WriteLine("var_y And var_z - is true")
End If
If (var_y Or var_z) Then
Console.WriteLine("var_y Or var_z - is true")
End If
'Only logical operators
If (var_w AndAlso var_x) Then
Console.WriteLine("var_w AndAlso var_x - is true")
End If
If (var_w OrElse var_x) Then
Console.WriteLine("var_w OrElse var_x - is true")
End If
var_w = False
var_x = True
If (var_w And var_x) Then
Console.WriteLine("var_w And var_x - is true")
Else
Console.WriteLine("var_w And var_x - is not true")
End If
If (Not (var_w And var_x)) Then
Console.WriteLine("var_w And var_x - is true")
End If
Console.ReadLine()
End Sub
End Module
23. VB.Net - Statements
A statement is a complete instruction in Visual Basic programs. It may contain keywords, operators,
variables, literal values, constants and expressions.
Statements could be categorized as −
Declaration statements − these are the statements where you name a variable, constant, or procedure,
and can also specify a data type.
Executable statements − these are the statements, which initiate actions. These statements can call a
method or function, loop or branch through blocks of code or assign values or expression to a variable
or constant. In the last case, it is called an Assignment statement.
Declaration Statements
The declaration statements are used to name and define procedures, variables, properties, arrays, and
constants. When you declare a programming element, you can also define its data type, access level,
and scope.
The programming elements you may declare include variables, constants, enumerations, classes,
structures, modules, interfaces, procedures, procedure parameters, function returns, external procedure
references, operators, properties, events, and delegates.
Following are the declaration statements in VB.Net –
Sr.No Statements and Description Example
1
Dim Statement
Declares and allocates storage
space for one or more variables.
Dim number As Integer
Dim quantity As Integer = 100
Dim message As String = "Hello!"
2
Const Statement
Declares and defines one or more
constants.
Const maximum As Long = 1000
Const naturalLogBase As Object
= CDec(2.7182818284)
3
Enum Statement
Declares an enumeration and
defines the values of its members.
Enum CoffeeMugSize
Jumbo
ExtraLarge
Large
Medium
Small
End Enum
24. 4
Class Statement
Declares the name of a class and
introduces the definition of the
variables, properties, events, and
procedures that the class
comprises.
Class Box
Public length As Double
Public breadth As Double
Public height As Double
End Class
5
Structure Statement
Declares the name of a structure
and introduces the definition of
the variables, properties, events,
and procedures that the structure
comprises.
Structure Box
Public length As Double
Public breadth As Double
Public height As Double
End Structure
6
Module Statement
Declares the name of a module
and introduces the definition of
the variables, properties, events,
and procedures that the module
comprises.
Public Module myModule
Sub Main()
Dim user As String =
InputBox("What is your name?")
MsgBox("User name is" & user)
End Sub
End Module
7
Interface Statement
Declares the name of an interface
and introduces the definitions of
the members that the interface
comprises.
Public Interface MyInterface
Sub doSomething()
End Interface
8
Function Statement
Declares the name, parameters,
and code that define a Function
procedure.
Function myFunction
(ByVal n As Integer) As Double
Return 5.87 * n
End Function
9
Sub Statement
Declares the name, parameters,
and code that define a Sub
procedure.
Sub mySub(ByVal s As String)
Return
End Sub
10
Event Statement Public Event Finished()
25. Declares a user-defined event.
11
Delegate Statement
Used to declare a delegate.
Delegate Function MathOperator(
ByVal x As Double,
ByVal y As Double
) As Double
Executable Statements
An executable statement performs an action. Statements calling a procedure, branching to another place
in the code, looping through several statements, or evaluating an expression are executable statements.
An assignment statement is a special case of an executable statement.