1. Trang chủ
  2. » Giáo án - Bài giảng

Chapter 1 Introduction to the Visual Studio 2005

39 476 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 39
Dung lượng 493 KB

Nội dung

Chapter Introduction to the Visual Studio 2005 INTRODUCTION Visual Studio.NET  Included in Visual Studio.NET  Visual Basic (VB.Net, VB 8.0)  C++  C# (C Sharp)  J++ (J Sharp)  NET Framework © Slide Introduction  Visual Studio NET  Framework  Microsoft’s Integrated Development Environment (IDE) © Slide The NET Framewor k  The Common Language Runtime (CLR) is another central part of the NET Frameworkit executes NET programs  The NET Framework Class Library (FCL) can be used by any NET language (biet Net) © Slide The Net Framewor k  Understanding the NET Framework Architecture © Slide Understanding the Common Language Runtime  Common Language Runtime Architecture © Slide Progr amming Languages  Procedural  Program specifies exact sequence  Event Driven  Object Oriented Programming (C#.NET)  User controls sequence  Click event  Double Click event  Change event © Slide Object Model  Object ==> Like a Noun in English  Form and Controls on forms (Button, Text boxes…)  Property ==> Like Adjective,they describe object  Text, Name, BackColor, Font and Size  Method ==> Like Verb, They are actions that objects exhibit  Close();  Hide();  Event Like Verb  Click  doubleClick, selectedchange © Slide INTRODUCTION C#.NET  C#.NET supports programming projects that run in both Windows desktop and Internet environments We will focus on the Windows desktop  Both of these environments are based on what is termed a graphical user interface or GUI for short © Slide Visual Studio NET Integ rated Development Environment (IDE) Over v iew Fig 2.1 Start Page in Visual Studio NET © Slide 10 Simple Progr am: Displaying Text and an Image  Insert an image  The Image property sets the image that appears (Fig 2.26)  Pictures should be of type gif, jpeg, or png (Fig 2.27)  The picture box is resizable to fit the entire image (Fig 2.28)  Save the project  In the Solution Explorer select File > Save  Using Save All will save the source code and the project  Run the project (Fig 2.29)  In run mode several IDE features are disabled  Click Build Solution in the Build menu to compile the solution  Click Debug in the Start menu or press the F5 key © Slide 25 Simple Progr am: Displaying Text and an Image  Terminating the program  Click the close button (x in the top right corner)  Or click the End button in the toolbar © Slide 26 Introduction to C# Programming  Console applications  No visual components  Only text output  Two types  MS-DOS prompt – Used in Windows 95/98/ME  Command prompt – Used in windows 2000/NT/XP  Windows applications  Forms with several output types  Contain Graphical User Interfaces (GUIs) © Slide 27 Simple Progr am: Printing a line of text  Comments  Comments can be created using //…  Multi-lines comments use /* … */  Comments are ignored by the compiler  Used only for human readers  Namespaces  Groups related C# features into a categories  Allows the easy reuse of code  Many namespaces are found in the NET framework library  Must be referenced in order to be used  White Space  Includes spaces, newline characters and tabs © Slide 28 Simple Progr am: Printing a line of text  Keywords  Words that cannot be used as variable or class names or any other capacity  Have a specific unchangeable function within the language  Example: class  All keywords are lowercase  Classes  Class names can only be one word long (i.e no white space in class name )  Class names are capitalized, with each additional English word capitalized as well (e.g., MyFirstProgram )  Each class name is an identifier  Can contain letters, digits, and underscores (_)  Cannot start with digits  Can start with the at symbol (@) © Slide 29 Simple Progr am: Printing a line of text  Class bodies start with a left brace ({)  Class bodies end with a right brace (})  Methods  Building blocks of programs  The Main method  Each console or windows application must have exactly one  All programs start by executing the Main method  Braces are used to start ({) and end (}) a method  Statements  Anything in quotes (“) is considered a string  Every statement must end in a semicolon (;) © Slide 30 Simple Progr am: Printing a line of text  Graphical User Interface  GUIs are used to make it easier to get data from the user as well as display data to the user  Message boxes  Within the System.Windows.Forms namespace  Used to prompt or display information to the user © Slide 31 Ex :Welcome1.cs // Fig 3.1: Welcome1.cs // A first program in C# using System; class Welcome1 { static void Main( string[] args ) { 10 11 12 } Console.WriteLine( "Welcome to C# Programming!" ); } Welcome to C# Programming! Simple Progr am: Printing a Line of Text Fig 3.3 Execution of the Welcome1 program © Slide 33 Ex2: Welcome2.cs // Fig 3.4: Welcome2.cs // Printing a line with multiple statements using System; class Welcome2 { static void Main( string[] args ) { Console.Write( "Welcome to " ); Console.WriteLine( "C# Programming!" ); } } Welcome to C# Programming! Ex 3: Welcome3.cs // Fig 3.5: Welcome3.cs // Printing multiple lines with a single statement using System; class Welcome3 Welcome to C# Programming! { static void Main( string[] args ) { 10 11 12 } Console.WriteLine( "Welcome\nto\nC#\nProgramming!" ); } Simple Progr am: Printing a Line of Text © Slide 36 // Printing multiple lines in a dialog Box using System; using System.Windows.Forms; class Welcome4 { static void Main( string[] args ) { MessageBox.Show( "Welcome\n to \n C# \n programming!" ); } } Another Simple Progr am: Adding Integers  Primitive data types  Data types that are built into C#  String, Int, Double, Char, Long  15 primitive data types (chapter 4)  Each data type name is a C# keyword  Same type variables can be declared on separate lines or on one line  Console.ReadLine()  Used to get a value from the user input  Int32.Parse()  Used to convert a string argument to an integer  Allows math to be preformed once the string is converted © Slide 38 Finish © Slide 39 ... Terminating the program  Click the close button (x in the top right corner)  Or click the End button in the toolbar © Slide 26 Introduction to C# Programming  Console applications  No visual components.. .1 INTRODUCTION Visual Studio. NET  Included in Visual Studio. NET  Visual Basic (VB.Net, VB 8.0)  C++  C# (C Sharp)  J++ (J Sharp)  NET Framework © Slide Introduction  Visual Studio. .. © Slide 31 Ex :Welcome1.cs // Fig 3 .1: Welcome1.cs // A first program in C# using System; class Welcome1 { static void Main( string[] args ) { 10 11 12 } Console.WriteLine( "Welcome to C# Programming!"

Ngày đăng: 13/05/2014, 11:39

TỪ KHÓA LIÊN QUAN

w