introduction to the visual studio 2010

42
FACULTY OF IMFORMATION TECHNOLOGY Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com HAI PHONG UNIVERSITY

Upload: manton

Post on 25-Feb-2016

63 views

Category:

Documents


3 download

DESCRIPTION

Introduction to the Visual Studio 2010. Chapter 1:. What C# is &How a C# Program runs . What’s the .NET Framework & What it contains. What you Learn in this chapter?. Visual Studio 2010 & C#. DEMO C# Console. Microsoft’s Modern software development platform. .Net Framework - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

Page 2: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

Introduction to the Visual Studio 2010

Chapter 1:

Page 3: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

What you Learn in this

chapter?

What’s the .NET Framework &

What it contains

What C# is &How a

C# Program runs

Visual Studio 2010& C#

DEMO C# Console

Page 4: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

.Net Framework[4.0]

Microsoft’s Modern software development platform

Support several programming languages: C# ,VB, C++,F#...

Common Language Runtime (CLR)

Include .NET Framework Class Library(FCL)

Page 5: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

Programming language use to create application will run in the .NET CLR

Why C# ?

Evolution of the C & C++ languages

Incorporate the best features from other languages & Clearing up their problems

Syntax is simple

Directly accessing & manipulating system memory

Page 6: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

Application you can write in C#

Windows Application

Web Application Web Services

Page 7: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

How a C# program runs?

Page 8: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

C# Source(.cs)

C# compiler

Assembly(.exe or .dll)

CLR loader

CLRJIT compiler

Operating system

CPU & otherhardware

.NET libraries

Page 9: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

1 Write source code c# and saved file with .cs extension

2 C# compiler=> Compile source code to an intermediate language (MSIL)

3 MSIL is contained in an assembly(.exe or .dll extension)

4 Can use source code or reference .NET framework libraries

Page 10: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

5 CLR runs on top of host operating system

6 CLR loads assembly & uses JIT compiler to translate MSIL to native machine code

7 Load .NET libraries if need

8 MSIL code can execute on any CPUs if CPU is supported by CLR

Page 11: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

Visual

Studio

2010

Powerful, professional Integrated Development Environment (IDE)

Integrated compiler, debugger,Other useful tool…

We can work: Console application Window application Web application .NET Libraries

Page 12: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

Visual

Studio

2010

Solution ???

Project & Project Properties

Build ???

Debugging???

Page 13: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

Solutions and Projects group the items needed to create a program or application: A Solution can contain one or more Project A Project represents a particular part of a

solution A Project contains source code file, settings &

resource for application A Project can contain Class Reference libraries Etc…

Page 14: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

How to create Solution

& Project?

Page 15: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

1 Solution

1. File/New/Project (or Ctrl+ Shift +N)

2. Choose “Visual Studio Solutions” in left panel

3. Enter Name & location solution => click OK

Page 16: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

You can see “Solution1” name in the right panel

Page 17: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

HowTo

add New

Project:

2

1. Right click on Solution12. Choose Add item3. Choose New Project

Page 18: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

add New

ProjectDialog

You can choose any Application

Type name & click OK

Page 19: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

Manydifferent projects

in the Solution

Page 20: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

Problem: You don’t know which Project that you want to run

1. Right click on Project2. Choose Set as

StartUp Project

Page 21: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

Problem: We have many Window Computing Platform…

To any PC can run your Application, you must config as below

Right click on Project & choose Properties

Page 22: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

Or Go to menu Project => Choose Project properties

Page 23: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

Project Properties dialog

1. Go to Build tab2. Platform target

please choose “Any CPU”

3. Save project

Page 24: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

How to add New Item in the Project

1.Right click on Project2.Choose Add item3.Choose New Item

Page 25: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

Choose anyitem

Enter name and click “Add” button

Page 26: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

AssemblyInfo file Reference .NET libraries

Page 27: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

Solution Folder content

Page 28: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

Project Folder content

Page 29: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

How to build Solution & Project

Build Solution

Build Project

Batch Build

Page 30: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

Batch Build You should use Batch Build

You can check or uncheck project to build

Build

Page 31: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

How to Debugging?

Page 32: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

1. Choose line you want to start debugging

2. Go to Debug menu3. Choose Toggle

Breakpoint or press F9

Page 33: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

Breakpoint here

Page 34: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

4. Go to Debug5. Choose Start Debugging or press F5

Also you can clear all Breakpoints

Page 35: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

You can see The Yellow Line

And the name + value of variables

Page 36: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

Step IntoStep OverStep Out

Page 37: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

Use QuickWatch to see detail information of variable at runtime

Page 38: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

QuickWatchDialog here

Variable’s infor

Page 39: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

You can change value of the variable and click Reevaluate button

Page 40: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

Page 41: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

Page 42: Introduction to the Visual Studio 2010

FACULTY OF IMFORMATION TECHNOLOGY

Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com

HAI PHONG UNIVERSITY

END