Date post: | 12-Jan-2015 |
Category: |
Technology |
Upload: | salonityagi |
View: | 2,509 times |
Download: | 2 times |
Introduction to Visual Introduction to Visual Studio.NETStudio.NET
AgendaAgenda
What is .NET?What is .NET?.NET Framework.NET FrameworkVisual Studio.NETVisual Studio.NETC#C#Visual Basic.NETVisual Basic.NETQ & AQ & A
What is Microsoft .NET?What is Microsoft .NET?
.NET represents an advanced new .NET represents an advanced new generation of software that will drive the generation of software that will drive the Next Generation Internet. Its purpose is Next Generation Internet. Its purpose is to make information available any time, to make information available any time, any place, and on any device.any place, and on any device.
Quick DefinitionQuick Definition.NET is an initiative to integrate all Microsoft .NET is an initiative to integrate all Microsoft
products with the “Next Generation” web.products with the “Next Generation” web.
http://www.microsoft.com/net/http://www.microsoft.com/net/
Next Generation InternetNext Generation Internet
Web siteWeb site
Web siteWeb site
Web siteWeb site
BackendBackendAppApp
MegaMegaServiceService
BackendBackendAppApp
MegaMegaServiceService
Loosely-Loosely-coupled, coupled, services services connected by connected by XML-based XML-based messages and messages and contracts, contracts, written in many written in many languageslanguages
ServiceServiceDeviceDevice
XML-XML-msgsmsgs ServiceService
ServiceService ServiceService
What is Microsoft .NET? What is Microsoft .NET? (Cont.)(Cont.)
Core components of .NET are:Core components of .NET are: .NET Infrastructure and Tools.NET Infrastructure and Tools .NET Services.NET Services
An integrated set of building block services for the new Internet, An integrated set of building block services for the new Internet, including Passport.NET (for user authentication), and services for including Passport.NET (for user authentication), and services for file storage, user preference management, calendar management, file storage, user preference management, calendar management, and many others.and many others.
.NET User Experience.NET User Experience A broader, more adaptive user experience, where information is delivered A broader, more adaptive user experience, where information is delivered
in a variety of ways on a variety of different devices.in a variety of ways on a variety of different devices.
.NET Device Software.NET Device Software Enables a new breed of smart Internet devices that can leverage Web Enables a new breed of smart Internet devices that can leverage Web
ServicesServices
http://www.microsoft.com/business/vision/netvision.asphttp://www.microsoft.com/business/vision/netvision.asp
.NET Infrastructure and Tools.NET Infrastructure and Tools
.NET Infrastructure and Tools.NET Infrastructure and Tools.NET Enterprise Servers.NET Enterprise Servers
SQL 2000SQL 2000 Exchange 2000Exchange 2000 ISA 2000ISA 2000 Host Integration Server 2000Host Integration Server 2000 Application Center 2000Application Center 2000 BizTalk Server 2000BizTalk Server 2000 Commerce Server 2000Commerce Server 2000
Visual Studio.NETVisual Studio.NET.NET Framework.NET FrameworkWindows.NETWindows.NET
““Whistler” (Windows XP)Whistler” (Windows XP)
.NET Framework.NET Framework
.NET Framework.NET Framework
.NET Framework consists of 3 main .NET Framework consists of 3 main parts:parts:Common Language RuntimeCommon Language RuntimeFramework Classes/LibrariesFramework Classes/LibrariesASP.NETASP.NET
http://msdn.microsoft.com/nethttp://msdn.microsoft.com/net
The .NET FrameworkThe .NET Framework
Base Class LibraryBase Class Library
Common Language SpecificationCommon Language Specification
Common Language RuntimeCommon Language Runtime
ADO.NET: Data and XMLADO.NET: Data and XML
VBVB C++C++ C#C#V
isual S
tud
io.N
ET
Visu
al Stu
dio
.NE
T
ASP.NET: Web ServicesASP.NET: Web Servicesand Web Formsand Web Forms
JScriptJScript ……
WindowsWindowsFormsForms
WindowsWindowsFormsForms
Common Language Runtime Common Language Runtime (CLR)(CLR)
A common runtime for all .NET languagesA common runtime for all .NET languages Common type systemCommon type system Common metadataCommon metadata Intermediate Language (IL) to native code compilersIntermediate Language (IL) to native code compilers Memory allocation and garbage collectionMemory allocation and garbage collection Code execution and securityCode execution and security
Over 15 languages supported todayOver 15 languages supported today C#, VB, Jscript, Visual C++ from MicrosoftC#, VB, Jscript, Visual C++ from Microsoft Perl, Python, Smalltalk, Cobol, Haskell, Mercury, Eiffel, Perl, Python, Smalltalk, Cobol, Haskell, Mercury, Eiffel,
Oberon, Oz, Pascal, APL, CAML, Scheme, etc.Oberon, Oz, Pascal, APL, CAML, Scheme, etc. Rational is working on Java compiler for CLRRational is working on Java compiler for CLR
Common Language Runtime Common Language Runtime (CLR)(CLR)
Enables cross-language Enables cross-language interoperabilityinteroperabilityCommon Language Specification Common Language Specification
describes interoperability requirementsdescribes interoperability requirementsLanguage/Hardware/OS IndependentLanguage/Hardware/OS Independent
Compact framework for small devicesCompact framework for small devices Industrial strength Garbage collectorIndustrial strength Garbage collector
Designed for multi-processor serversDesigned for multi-processor servers
CLR: Execution ModelCLR: Execution ModelVBVBSource Source
codecodeCompilerCompiler
C++C++C#C#
CompilerCompilerCompilerCompiler
AssemblyAssemblyIL CodeIL Code
AssemblyAssemblyIL CodeIL Code
AssemblyAssemblyIL CodeIL Code
Operating System ServicesOperating System Services
Common Language RuntimeCommon Language Runtime
JIT CompilerJIT Compiler
Native CodeNative Code
ManagedManagedcodecode
UnmanagedUnmanagedComponentComponent
.NET Framework Libraries.NET Framework Libraries
Single Single consistentconsistent set of object set of object oriented class libraries to enable oriented class libraries to enable building distributed web applications building distributed web applications (Unified Classes)(Unified Classes)
Built using classes arranged across Built using classes arranged across logical hierarchical namespaceslogical hierarchical namespacesFor example: System.Data.SQLFor example: System.Data.SQL
Work with all CLR languagesWork with all CLR languagesNo more “VBRun” or “MFC” divideNo more “VBRun” or “MFC” divide
.NET Framework Libraries.NET Framework Libraries
Unified Classes
Web Classes (ASP.NET)
XML Classes
System Classes
Drawing Classes
Windows FormsData (ADO.NET)
Controls, Caching, Security, Session, Configuration etc
Collections, Diagnostics, Globalization, IO, Security,Threading Serialization, Reflection, Messaging etc
ADO, SQL,Types etc
Drawing, Imaging, Text, etc
Design, Cmpnt Model etc
XSLT, Path, Serialization etc
ASP.NETASP.NET ASP.NET is a new programming framework ASP.NET is a new programming framework
designed to make web apps easier to: designed to make web apps easier to: Build, Deploy, RunBuild, Deploy, Run
Radical advancement of today’s ASPRadical advancement of today’s ASP Broader programming language supportBroader programming language support
Visual Basic.NET, Jscript.NET, C#Visual Basic.NET, Jscript.NET, C# Easier page programming modelEasier page programming model
NamespacesNamespaces Richer XML features and integrationRicher XML features and integration XCopy/FTP deploymentXCopy/FTP deployment Better reliability and recoveryBetter reliability and recovery Excellent Visual Studio designer supportExcellent Visual Studio designer support
ASP.NETASP.NET
ASP.NET is compiled, not interpretedASP.NET is compiled, not interpreted Better performanceBetter performance Early binding, strong typing, JIT compiling to native Early binding, strong typing, JIT compiling to native
codecode Configuration settings in XML-based filesConfiguration settings in XML-based files Session state can now be shared across a web farm of Session state can now be shared across a web farm of
ASP.NET serversASP.NET servers .NET State Server Process manages state.NET State Server Process manages state
Application state is still single severApplication state is still single sever ASP.NET detects and recovers from problemsASP.NET detects and recovers from problems
Access violations, memory leaks, deadlocksAccess violations, memory leaks, deadlocks ASP.NET supports pre-emptive cycling of appsASP.NET supports pre-emptive cycling of apps
Time and request based settingsTime and request based settings
Visual Studio.NETVisual Studio.NET
Visual Studio.NETVisual Studio.NET
Integrated Development EnvironmentIntegrated Development Environment Visual Basic.NETVisual Basic.NET
Many language enhancementsMany language enhancements Inheritance,Overloading, Free Threading Inheritance,Overloading, Free Threading
Visual C++Visual C++ Integration with .NET Framework with managed extensions Integration with .NET Framework with managed extensions
(classes)(classes) C#C#
New development languageNew development language Based on C/C++ with Garbage Collection/Memory ManagementBased on C/C++ with Garbage Collection/Memory Management
JUMP (Java User Migration Path) to .NET JUMP (Java User Migration Path) to .NET (1/25/01)(1/25/01)
Visual J++ has been removed from the Visual Studio suite.Visual J++ has been removed from the Visual Studio suite.
http://msdn.microsoft.com/vstudiohttp://msdn.microsoft.com/vstudio
JUMP to .NETJUMP to .NET
Consists of 3 sets of tools and a Consists of 3 sets of tools and a service offering service offering Interoperability supportInteroperability supportProgramming tools supportProgramming tools supportAutomated conversion from Java Automated conversion from Java
language source code to C#language source code to C#Migration servicesMigration services
VS.NET FeaturesVS.NET Features
Single IDE for all LanguagesSingle IDE for all Languages Server ExplorerServer Explorer
Event Viewer, Message Queues, ServicesEvent Viewer, Message Queues, Services SQL Databases, Data Connection, Etc.SQL Databases, Data Connection, Etc.
Integrated IE BrowserIntegrated IE Browser HTML/XML EditorsHTML/XML Editors Macros/Macro ExplorerMacros/Macro Explorer Solution ExplorerSolution Explorer Tabbed DocumentsTabbed Documents Dynamic HelpDynamic Help Common Forms EditorCommon Forms Editor
VB.NET, C++, and C#VB.NET, C++, and C#
Visual Studio.NET DemoVisual Studio.NET Demo
C#C#
Intro to C#Intro to C# Design Goals of C#Design Goals of C#
Component Orientated LanguageComponent Orientated Language Robust and Durable SoftwareRobust and Durable Software
FeaturesFeatures ClassesClasses NamespacesNamespaces No header filesNo header files
VB.NET vs. C#VB.NET vs. C# Ability to embed C++ code in C# codeAbility to embed C++ code in C# code Elegance of C/C++ languageElegance of C/C++ language
Design Goals C#Design Goals C#
Component OrientedComponent OrientedProperties, methods, eventsProperties, methods, events
Robust and DurableRobust and DurableGarbage collection (No memory leaks and Garbage collection (No memory leaks and
stray pointers)stray pointers)Exception HandlingException HandlingType-safety (No uninitialized variables)Type-safety (No uninitialized variables)
Based on C++Based on C++ InteroperabilityInteroperability
Support for XML, SOAPSupport for XML, SOAP
Visual Basic.NETVisual Basic.NET
Visual Basic.NETVisual Basic.NET
Leave it in VB6Leave it in VB6 WebClasses, ActiveX Documents, DHTML ProjectsWebClasses, ActiveX Documents, DHTML Projects
Thinking in VB.NETThinking in VB.NET Data Types, Type vs. StructureData Types, Type vs. Structure Property Functions, Zero Bound ArraysProperty Functions, Zero Bound Arrays Default ParametersDefault Parameters
New FeaturesNew Features Forms Designer, Declaration SyntaxForms Designer, Declaration Syntax Structured Exception HandlingStructured Exception Handling Overloading, InheritanceOverloading, Inheritance Free ThreadingFree Threading
ADO.NETADO.NET
VB.NET: Data TypesVB.NET: Data TypesTrue is now = 1True is now = 1 Integer Data type has changedInteger Data type has changed
Short (Int16), Integer (Int32), Long (Int64)Short (Int16), Integer (Int32), Long (Int64)VB 6VB 6
VB.NETVB.NET
Dim intAge As IntegerDim intID As Long
Dim intAge As ShortDim intID As Integer
VB.NET: Type vs. StructureVB.NET: Type vs. StructureDefining user defined types (UDT) has Defining user defined types (UDT) has
a new syntaxa new syntaxVB 6VB 6
VB.NETVB.NET
Type Customer CustomerNumber as Long CustomerName As String CustomerCompany As StringEnd Type
Structure Customer Public CustomerNumber as Integer Public CustomerName As String Public CustomerCompany As StringEnd Structure
VB.NET: Property FunctionsVB.NET: Property FunctionsVB 6VB 6
VB.NETVB.NET
Public Property Get CustomerName() As StringCustomerName = m_CustName
End PropertyPublic Property Let CustomerName(sCustName As String)
m_CustName = sCustNameEnd Property
Public Property CustomerName() As String Get CustomerName = m_CustName End Get Set m_CustName = Value End SetEnd Property
VB.NET: Zero Bound ArraysVB.NET: Zero Bound ArraysOption Base 1|0 has been Option Base 1|0 has been
removedremovedAll arrays are base 0All arrays are base 0The following declaration has 5 The following declaration has 5
elements, arrElements(0) thru elements, arrElements(0) thru arrElements(4)arrElements(4)Dim arrElements(5) As String
VB.NET: Default PropertiesVB.NET: Default PropertiesDefault properties are no longer supported.Default properties are no longer supported. Important! Early Binding is key in VB6Important! Early Binding is key in VB6VB 6VB 6
VB.NETVB.NET
Note: Recordset (COM ADO) is not the preferred data storage object in VB.NET, this is just an example.Note: Recordset (COM ADO) is not the preferred data storage object in VB.NET, this is just an example.
txtAddress = rs(“Addr_1”)lblFName = “First Name”
txtAddress.Text = rs(“Addr_1”).valuelblFName.Text = “First Name”
VB.NET Forms DesignerVB.NET Forms Designer
New Forms DesignerNew Forms DesignerVB.NET, C++, C#VB.NET, C++, C#
Enhanced Menu EditorEnhanced Menu EditorControl AnchorsControl AnchorsNew PropertiesNew PropertiesVisual InheritanceVisual Inheritance
VB.NET Demo VB.NET Demo
VB.NET: New Declaration VB.NET: New Declaration SyntaxSyntaxVariables can now be declared and Variables can now be declared and
initialized on declaration line.initialized on declaration line.VB 6VB 6
VB.NETVB.NET
Dim intLoop As IntegerintLoop = 10
Dim intLoop As Integer = 10
VB.NET: Structured Exception VB.NET: Structured Exception HandlingHandling VB.NET supports elegant error handlingVB.NET supports elegant error handling
VB 6VB 6
VB.NETVB.NET
On Error Goto ErrTag ... ‘clean up Exit FunctionErrTag: ‘error handling ‘clean upEnd Function
Try ...Catch ‘error handlingFinally ‘clean upEnd Try
VB.NET: OverloadingVB.NET: OverloadingFunctions can now be overloaded Functions can now be overloaded
(accept arguments of different types)(accept arguments of different types)VB.NETVB.NET
Overloads Function ConvertSQL(ByVal strString As String) As String ConvertSQL = "'" & strString & "'"End Function Overloads Function ConvertSQL(ByVal intNum As Integer) As String ConvertSQL = CStr(intNum)End Function
VB.NET: InheritanceVB.NET: InheritancePublic Class Customer Private m_CustName As String Public Property CustomerName() As String Get CustomerName = m_CustName End Get Set m_CustName = Value End Set End Property End Class
Public Class CustCompany Inherits Customer Private m_CustCompany As String Public Property CustomerCompany() As String Get CustomerCompany = m_CustCompany End Get Set m_CustCompany = Value End Set End PropertyEnd Class
ADO.NETADO.NET
ADO.NET is the preferred data access ADO.NET is the preferred data access method in the .NET Frameworkmethod in the .NET Framework
Better support for disconnected data Better support for disconnected data accessaccess
Specialized namespacesSpecialized namespacesSystem.Data.SQL – Tuned for SQL ServerSystem.Data.SQL – Tuned for SQL Server
System.Data.ADO – OLEDBSystem.Data.ADO – OLEDB
PortablePortable Native XML SupportNative XML Support
ADO.NETADO.NET
ADOConnectionADOConnection Similar to Connection object in ADOSimilar to Connection object in ADO
ADOCommandADOCommand Similar to Command object in ADOSimilar to Command object in ADO
ADODataSetCommandADODataSetCommand Somewhat like Recordsets for ADO.NET (DataSet)Somewhat like Recordsets for ADO.NET (DataSet) Designed for stateless operationsDesigned for stateless operations
ADODataReaderADODataReader For streaming methods, similar to StreamFor streaming methods, similar to Stream
SQLConnection, SQLCommand, and SQLConnection, SQLCommand, and SQLDataSetCommand, SQLDataReaderSQLDataSetCommand, SQLDataReader
VB.NET Demo VB.NET Demo
VB 6 Moving ForwardVB 6 Moving Forward
AvoidAvoid Web Classes, ActiveX Docs, DHTML AppsWeb Classes, ActiveX Docs, DHTML Apps
Development TechniquesDevelopment Techniques Early BindingEarly Binding Don’t use Default PropertiesDon’t use Default Properties Use Constants (such as Use Constants (such as truetrue)) Avoid GoSubAvoid GoSub Use ByVal and ByRef explicitly (ByVal is now default)Use ByVal and ByRef explicitly (ByVal is now default) Use ADOUse ADO
VB6 to VB.NET Conversion TechniquesVB6 to VB.NET Conversion Techniques Relax, take breaks oftenRelax, take breaks often
ResourcesResources MicrosoftMicrosoft
http://www.microsoft.com/nethttp://www.microsoft.com/net
http://msdn.microsoft.com/nethttp://msdn.microsoft.com/net
Programmer ResourcesProgrammer Resourceshttp://www.gotdotnet.comhttp://www.gotdotnet.com
http://www.devx.comhttp://www.devx.com
VB6 to VB.NET WhitepaperVB6 to VB.NET Whitepaperhttp://msdn.microsoft.com/library/techart/vb6tovbdotnet.hthttp://msdn.microsoft.com/library/techart/vb6tovbdotnet.htmm
Example SiteExample Sitehttp://www.ibuyspy.comhttp://www.ibuyspy.com