Top Banner
VB.NET Introduction
11
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Vb

VB.NET Introduction

Page 2: Vb

What is .NET Framework

• The Microsoft .NET Framework is a software framework that can be installed on computers running Microsoft Windows operating systems.

• The .NET Framework is a key Microsoft offering and is intended to be used by most new applications created for the Windows platform.

• The framework's Base Class Library provides a large range of features including user interface, data and data access, database connectivity, cryptography, web application development, numeric algorithms, and network communications.

Page 3: Vb

Understanding the .NET Framework• .NET framework is a Windows

Component that supports the building and running of windows applications and XML Web services. The purpose of the component is to provide the user with a consistent object oriented programming environment whether the code is stored locally or remotely.

• The .NET framework has two major components-- The Common Runtime (CLR) and the Class Library

Page 4: Vb

CLR (Common Language Runtime)• The Common Language Runtime (CLR) is a

core component of Microsoft's .NET initiative.• The CLR runs a form of bytecode called the

Common Intermediate Language (CIL, previously known as MSIL -- Microsoft Intermediate Language).

• Developers using the CLR write code in a language such as C# or VB.NET. At compile time, a .NET compiler converts such code into CIL code. At runtime, the CLR's just-in-time compiler converts the CIL code into code native to the operating system.

Page 5: Vb

Working of CLR

Page 6: Vb

CLR Features• Memory Management (Memory management is the act of

managing computer memory. In its simpler forms, this involves providing ways to allocate portions of memory to programs at their request, and freeing it for reuse when no longer needed. The management of main memory is critical to the computer system.Virtual memory systems separate the memory addresses used by a process from actual physical addresses, allowing separation of processes and increasing the effectively available amount of RAM using disk swapping The quality of the virtual memory manager can have a big impact on overall system performance.)

• Thread Management • Exception Handling • Garbage Collection • Security • Other system services.• CLR eliminates many common software issues like handling of

object layout, references to objects and garbage clearance• It lends support to existing applications.

Page 7: Vb

Namespaces• Namespaces • A namespace is a collection of different classes. All VB applications are

developed using classes from the .NET System namespace. The namespace with all the built-in VB functionality is the System namespace. All other namespaces are based on this System namespace.

• Some Namespaces and their use: • System: Includes essential classes and base classes for commonly used data

types, events, exceptions and so onSystem.Collections: Includes classes and interfaces that define various collection of objects such as list, queues, hash tables, arrays, etcSystem.Data: Includes classes which lets us handle data from data sourcesSystem.Data.OleDb: Includes classes that support the OLEDB .NET providerSystem.Data.SqlClient: Includes classes that support the SQL Server .NET providerSystem.Diagnostics: Includes classes that allow to debug our application and to step through our codeSystem.Drawing: Provides access to drawing methods

Page 8: Vb

NamespacesSystem.Globalization: Includes classes that specify culture-related informationSystem.IO: Includes classes for data access with FilesSystem.Net: Provides interface to protocols used on the internetSystem.Reflection: Includes classes and interfaces that return information about types, methods and fieldsSystem.Security: Includes classes to support the structure of common language runtime security systemSystem.Threading: Includes classes and interfaces to support multithreaded applicationsSystem.Web: Includes classes and interfaces that support browser-server communicationSystem.Web.Services: Includes classes that let us build and use Web ServicesSystem.Windows.Forms: Includes classes for creating Windows based formsSystem.XML: Includes classes for XML support

Page 9: Vb

Working With VB.NET

In Visual Basic.Net there are 2 main applications we going to use.1. Windows Application2. Console Application

Windows ApplicationWindows Applications used for Design Purpose.

Console ApplicationConsole Applications are command-line oriented applications that allow us to read characters from the console, write characters to the console and are executed in the DOS version. Console Applications are written in code and are supported by the System.Console namespace.

Page 10: Vb

Working With VB.NET• Example For Console Applications

Module Module1Sub Main()System.Console.Write("Welcome to Console Applications")End SubEnd Module

Note the first line, we're creating a Visual Basic Module and Modules are designed to hold code. All the code which we write should be within the Module.Next line starts with Sub Main(), the entry point of the program.The third line indicates that we are using the Write method of the System.Console class to write to the console.

Page 11: Vb

Working With VB.NET• Example For Windows Applications

Public Class Form1Inherits System.Windows.Forms.Form

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)_Handles MyBase.LoadEnd SubPrivate Sub Button1_Click(ByVal sender As System.Object, ByVal e As _System.EventArgs) Handles Button1.ClickMsgBox("Welcome to Forms") End SubEnd Class