Introduction to Visual Studio.NET


Published on

Published in: Technology
1 Comment
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Introduction to Visual Studio.NET

    1. 1. Copyright ©2004 and Distribution Rights Held by DotNetTechnology, LLC. This material is exclusively used by DotNetTechnology, LLC Consultants as a teaching aid. Any unauthorized usage including teaching, copying, and redistribution is strictly prohibited. .NET Programming with VB.NET Session 2 Dutch Dasanaike November 2004
    2. 2. Course Outline <ul><li>Introduction to the .NET Framework </li></ul><ul><ul><li>Developing for the .NET framework </li></ul></ul><ul><ul><li>Understanding the Common Language Runtime (CLR) </li></ul></ul><ul><ul><li>The role of Namespaces and assemblies </li></ul></ul><ul><ul><li>Introduction to .NET Framework Namespaces </li></ul></ul><ul><li>Introduction to VB.NET </li></ul><ul><ul><li>What can VB.NET be used to build in the .NET Framework? </li></ul></ul><ul><ul><li>VB.NET Features </li></ul></ul><ul><ul><li>Creating a VB.NET Hello World Application </li></ul></ul><ul><ul><li>Compiling VB.NET applications </li></ul></ul><ul><ul><li>Changes between VB6 and VB.NET </li></ul></ul>
    3. 3. Course Outline <ul><li>Working in Visual Studio.NET </li></ul><ul><ul><li>Why use VS.NET? </li></ul></ul><ul><ul><li>Overview of VS.NET features </li></ul></ul><ul><ul><li>Creating a VB.NET solution and project using VS.NET </li></ul></ul><ul><ul><li>Project Configuration </li></ul></ul><ul><ul><li>Compiling projects </li></ul></ul><ul><li>VB.NET Language Fundamentals </li></ul><ul><ul><li>VB.NET Basics </li></ul></ul><ul><ul><li>Defining Variables, Constants, and Arrays in VB.NET </li></ul></ul><ul><ul><li>Conditionals and Looping </li></ul></ul>
    4. 4. Course Outline <ul><li>Building Classes and Structures </li></ul><ul><ul><li>What are classes and objects? </li></ul></ul><ul><ul><li>Adding fields to a class </li></ul></ul><ul><ul><li>Adding property set and get statements to a class </li></ul></ul><ul><ul><li>Adding methods to a class </li></ul></ul><ul><ul><li>Structures in VB.NET </li></ul></ul>
    5. 5. Course Outline <ul><li>Object-Oriented Programming Fundamentals </li></ul><ul><ul><li>Object-oriented language features </li></ul></ul><ul><ul><li>Object-oriented features of the .NET platform </li></ul></ul><ul><ul><li>Method overloading </li></ul></ul><ul><ul><li>Working with interfaces </li></ul></ul><ul><ul><li>The role of abstract classes </li></ul></ul><ul><ul><li>Understanding boxing and unboxing in .NET </li></ul></ul><ul><li>Events and Delegates </li></ul><ul><ul><li>The role of Events and Delegates in .NET </li></ul></ul><ul><ul><li>Creating Events </li></ul></ul><ul><ul><li>Creating Delegates </li></ul></ul><ul><ul><li>Creating Event Handlers </li></ul></ul>
    6. 6. Course Outline <ul><li>Working with .NET Framework Classes </li></ul><ul><ul><li>Overview of functionality in the framework class library </li></ul></ul><ul><ul><li>Handling file IO </li></ul></ul><ul><ul><li>Building strings with the StringBuilder class </li></ul></ul><ul><ul><li>Working with collections </li></ul></ul><ul><ul><li>Working with Dates and Times </li></ul></ul><ul><ul><li>Networking </li></ul></ul><ul><ul><li>Reflection </li></ul></ul>
    7. 7. Course Outline <ul><li>Creating Windows Forms Applications </li></ul><ul><ul><li>What are Windows Forms? </li></ul></ul><ul><ul><li>New features in Windows Forms </li></ul></ul><ul><ul><li>Classes in the System.Windows.Forms namespace </li></ul></ul><ul><ul><li>Creating a form </li></ul></ul><ul><ul><li>Adding Windows Controls to forms </li></ul></ul><ul><ul><li>Visual Inheritance </li></ul></ul><ul><ul><li>Handling Events </li></ul></ul>
    8. 8. Course Outline <ul><li>Creating ASP.NET Web Forms </li></ul><ul><ul><li>What are Web Forms? </li></ul></ul><ul><ul><li>Are ASP.NET Web Forms the same as &quot;classic&quot; ASP forms? </li></ul></ul><ul><ul><li>New Features in ASP.NET Web Forms </li></ul></ul><ul><ul><li>Code Behind Classes </li></ul></ul><ul><ul><li>Classes in the System.Web.UI namespace </li></ul></ul><ul><ul><li>Using Server Controls in Web Forms </li></ul></ul><ul><ul><li>Building User Controls </li></ul></ul>
    9. 9. Course Outline <ul><li>Data Access with ADO.NET </li></ul><ul><ul><li>What is ADO.NET </li></ul></ul><ul><ul><li>Comparing ADO and ADO.NET </li></ul></ul><ul><ul><li>Managed Provider Classes in ADO.NET </li></ul></ul><ul><ul><li>Connecting to a data base </li></ul></ul><ul><ul><li>Using the Command Object </li></ul></ul><ul><ul><li>Using the DataReader </li></ul></ul><ul><ul><li>Understanding the DataSet class </li></ul></ul><ul><ul><li>Binding data to Windows and Web Form Controls </li></ul></ul><ul><li>Structured Exception Handling </li></ul><ul><ul><li>Error handling in VB.NET compared to VB6 </li></ul></ul><ul><ul><li>Using Try…Catch blocks </li></ul></ul><ul><ul><li>Exception objects </li></ul></ul><ul><ul><li>Adding a Finally block </li></ul></ul><ul><ul><li>Throwing exceptions </li></ul></ul>
    10. 10. Course Outline <ul><li>Working with XML in .NET </li></ul><ul><ul><li>What is XML? </li></ul></ul><ul><ul><li>When would I use XML in .NET? </li></ul></ul><ul><ul><li>Overview of the XML Rules </li></ul></ul><ul><ul><li>XML support in .NET </li></ul></ul><ul><ul><li>XML Parsing API's in .NET </li></ul></ul><ul><ul><li>XML Serialization </li></ul></ul>
    11. 11. Course Outline <ul><li>Creating and Consuming Web Services </li></ul><ul><ul><li>What is a Web Service? </li></ul></ul><ul><ul><li>Why are Web Services Needed? </li></ul></ul><ul><ul><li>Web Service Examples </li></ul></ul><ul><ul><li>Web Service Architecture </li></ul></ul><ul><ul><li>Web Service Technologies </li></ul></ul><ul><ul><li>Using .NET attributes to create Web Methods </li></ul></ul><ul><ul><li>Integrating VB.NET objects into Web Methods </li></ul></ul><ul><ul><li>Creating proxies using VS.NET/WSDL.exe </li></ul></ul>
    12. 12. Course Outline <ul><li>Advanced VB.NET Features </li></ul><ul><ul><li>Working with Threads </li></ul></ul><ul><ul><li>Integrating COM objects into .NET applications via Interop </li></ul></ul><ul><ul><li>Versioning in .NET </li></ul></ul><ul><ul><li>Adding assemblies to the GAC </li></ul></ul><ul><ul><li>Calling distributed objects via remoting </li></ul></ul>
    13. 13. Section 1: Introduction to the .NET Framework <ul><li>Developing for the .NET Framework </li></ul><ul><li>CLR </li></ul><ul><li>MSIL </li></ul><ul><li>Namespaces and Assemblies </li></ul><ul><li>The .NET Framework Class Library </li></ul><ul><li>Framework User Interface Namespaces </li></ul><ul><li>Framework Data Access Namespaces </li></ul><ul><li>Framework Web Namespaces </li></ul>Dutch Dasanaike ©All Rights Reserved
    14. 14. Section Objectives <ul><li>After completing this section, you will be able to: </li></ul><ul><ul><li>Explain what the .NET framework offers developers </li></ul></ul><ul><ul><li>Define important .NET terms </li></ul></ul><ul><ul><li>Explain where MSIL fits into .NET </li></ul></ul><ul><ul><li>Explain the role of the CLR </li></ul></ul><ul><ul><li>Explain namespaces and assemblies </li></ul></ul><ul><ul><li>Explain the importance of the .NET framework namespaces </li></ul></ul>
    15. 15. Developing for the .NET Framework <ul><li>The .NET framework provides a managed computing platform where Web and client/server applications can be developed and executed. </li></ul><ul><li>As a VB.NET developer, the .NET platform provides: </li></ul><ul><ul><li>A consistent object-oriented environment </li></ul></ul><ul><ul><li>A code execution environment that minimizes versioning and deployment issues </li></ul></ul><ul><ul><li>An environment that eliminates performance issues associated with scripted or interpreted languages </li></ul></ul><ul><ul><li>A consistent application development experience (Web or client/server) </li></ul></ul><ul><ul><li>A platform that has the potential to integrate other operating systems and languages </li></ul></ul>
    16. 16. What Does the .NET Framework Contain? Visual Studio .NET CLI CLR Base class library Data and XML XML Web services Windows forms Web forms CLS VB C++ J#... JScript C#
    17. 17. CLR <ul><li>CLR manages the execution of language code in .NET applications. </li></ul><ul><li>Some features of the CLR include: </li></ul><ul><ul><li>The CLR provides a language-neutral environment. All languages are equal players and can interoperate with each other. </li></ul></ul><ul><ul><li>The CLR handles memory management. </li></ul></ul><ul><ul><li>The CLR provides a CTS that can be used for cross-language interoperability. </li></ul></ul><ul><ul><li>The CLR compiles code to MSIL. </li></ul></ul><ul><ul><li>The CLR manages role-based and code access security. </li></ul></ul><ul><ul><li>The CLR features a JIT compiler that translates MSIL into code that can run on the targeted system. </li></ul></ul><ul><ul><li>The CLR XCopy deployment (no more regsvr32.exe). </li></ul></ul>
    18. 18. CLR Elements Intermediate language runtime compilers CTS Execution support, runtime functions Security functionality Boolean Byte Char Double Int16 Int32 Etc. Garbage, collection, stack walker, code manager Class loader, memory layout
    19. 19. Language Support and the CLR <ul><li>The CLR provides a language-neutral environment where different languages can interoperate. The CTS defines a set of common types shared across all languages: </li></ul><ul><li>VB.NET </li></ul><ul><li>C# </li></ul><ul><li>JScript.NET </li></ul><ul><li>Cobol </li></ul><ul><li>Eiffel </li></ul><ul><li>Smalltalk </li></ul><ul><li>Managed C++ </li></ul><ul><li>Perl </li></ul><ul><li>J# </li></ul><ul><li>Component Pascal </li></ul><ul><li>Dyalog APL </li></ul><ul><li>Fortran </li></ul><ul><li>Oberon </li></ul><ul><li>Pascal </li></ul><ul><li>Python </li></ul><ul><li>Standard ML </li></ul><ul><li>RPG </li></ul>
    20. 20. Memory Management and the CLR <ul><li>Memory is allocated and freed automatically using garbage collection techniques. </li></ul><ul><li>Reference counting is eliminated, which reduces the source of many errors. </li></ul>Memory is automatically managed within the .NET framework through the CLR:
    21. 21. The VB.NET Compiler and the CLR Compilation CLR execution Code MSIL Source code VB.NET compiler Code Metadata Native code JIT compiler
    22. 22. MSIL Code Example <ul><li>.method public hidebysig instance class System.Xml.XmlNodeList SelectNodes(string xpath) cil managed </li></ul><ul><li>{ </li></ul><ul><li>.maxstack 2 </li></ul><ul><li>.locals (class System.Xml.XPath.XPathNavigator) </li></ul><ul><li>IL_0000: ldarg.0 </li></ul><ul><li>IL_0001: call instance class System.Xml.XPath.XPathNavigator System.Xml.XmlNode::CreateNavigator() </li></ul><ul><li>IL_0006: stloc.0 </li></ul><ul><li>IL_0007: ldloc.0 </li></ul><ul><li>IL_0008: ldarg.1 </li></ul><ul><li>IL_0009: callvirt instance class System.Xml.XPath.XPathNodeIterator System.Xml.XPath.XPathNavigator::Select(string) </li></ul><ul><li>IL_000e: newobj instance void System.Xml.XPath.XPathNodeList::.ctor(class System.Xml.XPath.XPathNodeIterator) </li></ul><ul><li>IL_0013: ret </li></ul><ul><li>} </li></ul>
    23. 23. Viewing MSIL <ul><li>ildasm.exe demo </li></ul>
    24. 24. Namespaces and Assemblies <ul><li>Namespace </li></ul><ul><ul><li>A namespace is a logical naming scheme for grouping related types. </li></ul></ul><ul><ul><li>Example: System.Data.sql </li></ul></ul><ul><li>Assembly </li></ul><ul><ul><li>An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality, a logical dll. An assembly can contain multiple namespaces. </li></ul></ul><ul><ul><li>Example: System.Data.dll </li></ul></ul>
    25. 25. The Relationship of Namespaces to Assemblies <ul><li>.NET classes are located in physical files called assemblies (.dll, .exe) that contain logical naming containers referred to as namespaces . </li></ul>System.Data System.Data.SqlClient System.Data.dll Assembly Namespace Namespace
    26. 26. Private vs. Shared Assemblies <ul><li>Assemblies are private to applications and by default cannot not be shared by multiple applications. </li></ul><ul><li>By placing assemblies in the GAC, they can be shared by multiple applications. </li></ul>Application 1 Application 2 Assembly GAC
    27. 27. Viewing Assemblies in the GAC <ul><li>By navigating to C:WINNTassembly, you can view assemblies in the GAC. </li></ul><ul><li>Assemblies can be installed into the GAC using gacutil.exe or during the installation process. </li></ul>
    28. 28. Assembly Versioning <ul><li>Multiple versions of an assembly can be stored in the GAC. Each assembly’s version information is stored within its metadata. </li></ul><ul><li>The CLR can handle running multiple versions of an application on the same physical machine (side-by-side mode). </li></ul>Assembly MSIL code Metadata
    29. 29. The .NET Framework Class Library <ul><li>The .NET Framework Class Library comes with a base set of classes that provide an enormous amount of functionality. </li></ul><ul><li>Examples of Framework Class Library capabilities are as follows: </li></ul><ul><ul><li>Messaging </li></ul></ul><ul><ul><li>I/O </li></ul></ul><ul><ul><li>Reflection </li></ul></ul><ul><ul><li>Networking </li></ul></ul><ul><ul><li>Globalization </li></ul></ul><ul><ul><li>Much more </li></ul></ul><ul><ul><li>Data access </li></ul></ul><ul><ul><li>Remoting </li></ul></ul><ul><ul><li>Serialization </li></ul></ul><ul><ul><li>Web services </li></ul></ul><ul><ul><li>Threading </li></ul></ul><ul><ul><li>Transactions </li></ul></ul><ul><ul><li>XML support </li></ul></ul>
    30. 30. Framework User Interface Namespaces Windows Forms System.Windows.Forms UI controls 2D drawing Imaging Printing Text Framework
    31. 31. Framework User Interface Namespaces (cont.) Web Forms System.Web.UI Design support Web forms HTML controls Web controls Framework
    32. 32. Framework Data Access Namespaces ADO.NET System.Data Architecture Common Data providers Data types Framework
    33. 33. Framework Data Access Namespaces (cont.) XML 1.0 Schemas/DTDs XSLT XPath XML serialization Framework XML System.XML
    34. 34. Framework Web Namespaces ASP.NET System.Web Applications E-mail Web clients Security Framework
    35. 35. Framework Web Namespaces (cont.) Web Services System.Web.Services Services Configuration Description Discovery Protocols Framework
    36. 36. Summary <ul><li>The .NET framework includes support for client/server and Web-based applications. </li></ul><ul><li>All .NET code (including VB.NET) is compiled into MSIL, which is then converted to native code by the CLR’s JIT compiler. </li></ul><ul><li>VB.NET code is managed by the CLR, which provides a runtime environment. </li></ul><ul><li>The CLR handles memory management, including garbage collection processing. </li></ul><ul><li>A robust set of base library classes that can be used by any .NET language is provided by the .NET framework. </li></ul>
    37. 37. <ul><li>All .NET languages are based upon the CTS? </li></ul><ul><ul><li>True </li></ul></ul><ul><ul><li>False </li></ul></ul><ul><li>Which of the following items is the CLR responsible for managing? </li></ul><ul><ul><li>a. Memory </li></ul></ul><ul><ul><li>b. Security </li></ul></ul><ul><ul><li>c. Compiling a language into MSIL </li></ul></ul><ul><ul><li>d. A and B </li></ul></ul><ul><ul><li>e. All of the above </li></ul></ul>Section Review © 2003 Global Knowledge Network, Inc. All rights reserved. Knowledge Check
    38. 38. <ul><li>Assemblies are logical containers that can hold types? </li></ul><ul><ul><li>True </li></ul></ul><ul><ul><li>False </li></ul></ul><ul><li>Assemblies are _____ to applications by default? </li></ul><ul><ul><li>a. Private </li></ul></ul><ul><ul><li>b. Public </li></ul></ul><ul><ul><li>c. Shared </li></ul></ul><ul><ul><li>d. Static </li></ul></ul>Section Review © 2003 Global Knowledge Network, Inc. All rights reserved. Knowledge Check
    39. 39. <ul><li>Which compiler is responsible for compiling MSIL into machine level (native) code? </li></ul><ul><ul><li>a. Language compiler </li></ul></ul><ul><ul><li>b. MSIL compiler </li></ul></ul><ul><ul><li>c. JIT compiler </li></ul></ul><ul><ul><li>d. Assembly compiler </li></ul></ul><ul><li>The COM plays a crucial role in .NET? </li></ul><ul><ul><li>True </li></ul></ul><ul><ul><li>False </li></ul></ul>Section Review © 2003 Global Knowledge Network, Inc. All rights reserved. Knowledge Check
    40. 40. <ul><li>Which managed .NET language provides the best performance? </li></ul><ul><ul><li>a. Managed C++ </li></ul></ul><ul><ul><li>b. VB.NET </li></ul></ul><ul><ul><li>c. C# </li></ul></ul><ul><ul><li>d. Cobol.NET </li></ul></ul><ul><ul><li>e. None of the above </li></ul></ul>Section Review © 2003 Global Knowledge Network, Inc. All rights reserved. Knowledge Check
    41. 41. Lab 1: Configuring the Lab Environment <ul><li>30 minutes </li></ul><ul><li>Lab Objectives: </li></ul><ul><ul><li>Create virtual directories in IISs </li></ul></ul><ul><li>Start IIS by clicking Start=>Control Panel=>Administrative tools=>Internet Information Services. </li></ul><ul><li>Right click on Default web site=> New, Virtual directory </li></ul>