An introduction to Visual Studio

advertisement
8/26/2008 Chapter 1 An introduction to Visual Studio Murach’s Visual Basic 2008, C1 © 2008, Mike Murach & Associates, Inc. Slide 1 Objectives Applied
· Use Visual Studio 2008 to do any of these operations:
· Open and close an existing Visual Basic project or solution
· Display the Form Designer for each of the forms in a project
· Use the Solution Explorer to review the files in a project
· Open, hide, and adjust the windows for a project
· Build and run a project Murach’s Visual Basic 2008, C1 © 2008, Mike Murach & Associates, Inc. Slide 2 Objectives (continued) Knowledge
· Describe the main difference between a Windows Forms application and a Web Forms application.
· Name the two languages that you can use for rapid application development with Visual Studio 2008.
· Describe the two main components of the .NET Framework.
· In general terms, describe the Visual Basic compiler, Microsoft Intermediate Language, the assembly, and the Common Language Runtime.
· Describe the use of each of these windows in the Visual Studio IDE: Form Designer, Code Editor, and Solution Explorer.
· In general terms, explain what makes it possible to select a target framework with Visual Studio 2008.
Murach’s Visual Basic 2008, C1 © 2008, Mike Murach & Associates, Inc. Slide 3 1 8/26/2008 A Windows Forms application running on the Windows desktop Murach’s Visual Basic 2008, C1 © 2008, Mike Murach & Associates, Inc. Slide 4 A Web Forms application running in a Web browser Murach’s Visual Basic 2008, C1 © 2008, Mike Murach & Associates, Inc. Slide 5 Visual Studio 2008 Editions Edition Description Express Edition A free, downloadable edition that supports just one of the Visual Studio programming languages. There is also an Express Edition of SQL Server called SQL Server 2005 Express. Standard Edition Designed for individual developers who want to build Windows and web applications Professional Edition Designed for individual developers who want to build a wide variety of Windows, web, mobile, and Office­based solutions Team System Murach’s Visual Basic 2008, C1 Intended for teams of developers working on large projects
© 2008, Mike Murach & Associates, Inc. Slide 6 2 8/26/2008 Programming languages supported by Visual Studio 2008
· Visual Basic
· Visual C#
· Visual C++ Murach’s Visual Basic 2008, C1 © 2008, Mike Murach & Associates, Inc. Slide 7 The .NET Framework .NET Applications Visual Basic Visual C# Visual C++ .NET Framework .NET Framework Class Library Windows Forms classes ASP.NET classes Other classes Common Language Runtime Managed applications Common Type System Intermediate Language Operating System and Hardware Windows 2000/2003 Murach’s Visual Basic 2008, C1 Windows XP Windows Vista © 2008, Mike Murach & Associates, Inc. Other Operating Systems Slide 8 The Visual Studio IDE
Murach’s Visual Basic 2008, C1 © 2008, Mike Murach & Associates, Inc. Slide 9 3 8/26/2008 How a Visual Basic application is compiled and run Visual Studio .NET Framework Integrated Development Environment
Visual Basic comp iler Common Language Runtime 1 2 3 Solution Assembly Project Intermediate Language (IL ) Source files Class re ferences Murach’s Visual Basic 2008, C1 © 2008, Mike Murach & Associates, Inc. Slide 10 The Start Page that’s displayed when you start Visual Studio Murach’s Visual Basic 2008, C1 © 2008, Mike Murach & Associates, Inc. Slide 11 The Open Project dialog box
Murach’s Visual Basic 2008, C1 © 2008, Mike Murach & Associates, Inc. Slide 12 4 8/26/2008 Project and solution concepts
· Every Visual Basic project has a project file with an extension of vbproj that keeps track of the files that make up the project and records various settings for the project.
· Every solution has a solution file with an extension of sln that keeps track of the projects that make up the solution.
· When you open a project file, Visual Studio opens the solution that contains the project. And when you open a solution file, Visual Studio automatically opens all the projects contained in the solution.
· The project file can be stored in the same directory as the solution file or in one of its subdirectories. Murach’s Visual Basic 2008, C1 © 2008, Mike Murach & Associates, Inc. Slide 13 Visual Studio with the Form Designer window displayed Murach’s Visual Basic 2008, C1 © 2008, Mike Murach & Associates, Inc. Slide 14 Visual Studio with the Code Editor window displayed
Murach’s Visual Basic 2008, C1 © 2008, Mike Murach & Associates, Inc. Slide 15 5 8/26/2008 The Solution Explorer Murach’s Visual Basic 2008, C1 © 2008, Mike Murach & Associates, Inc. Slide 16 Project files
· The Solution Explorer uses different icons to distinguish between source code files that define forms and those that don’t.
· Each form is defined by two Visual Basic source files where each file contains a partial class. The file with the vb extension contains the code that’s entered by the programmer; the file with the Designer.vb extension contains the code that’s generated when the programmer works with the Form Designer. When the project is compiled, these partial classes are combined into a single class that determines the appearance and operation of the form.
· A source code file that doesn’t define a form is usually stored in a single Visual Basic source file that contains a single class.
· The References folder contains references to the assemblies for the namespaces that the application can use. These namespaces contain the classes that the project requires. In most cases, all the references that you need are included when the project is created. Murach’s Visual Basic 2008, C1 © 2008, Mike Murach & Associates, Inc. Slide 17 Visual Studio with two floating windows and a hidden window
Murach’s Visual Basic 2008, C1 © 2008, Mike Murach & Associates, Inc. Slide 18 6 8/26/2008 How to rearrange windows
· To undock a docked window so it floats on the screen, drag it by its title bar away from the edge of the application window or double­click its title bar.
· To dock a floating window, drag it by its title bar onto one of the positioning arrows that become available. Or, double­click its title bar to return it to its default location.
· To hide a docked window, click its Auto Hide button. Then, the window is displayed as a tab at the edge of the screen, and you can display it by placing the mouse pointer over the tab.
· If two or more windows are grouped into tabbed windows, you can display any window in the group by clicking on its tab.
· If you dock, undock, hide, or unhide a tabbed window, all the windows in the group are docked, undocked, hidden, or unhidden. Murach’s Visual Basic 2008, C1 © 2008, Mike Murach & Associates, Inc. Slide 19 The form that’s displayed when the Financial Calculations project is run Murach’s Visual Basic 2008, C1 © 2008, Mike Murach & Associates, Inc. Slide 20 How to build a project without running it
· Use the BuildàBuild Solution command. Or, right­click the project in the Solution Explorer and select the Build command from the shortcut menu. This builds the Intermediate Language for the project and saves it in an assembly. How to run a project
· You can run a project by clicking on the Start Debugging button in the Standard toolbar or by pressing F5. Then, the first form of the project is displayed on top of the Visual Studio window.
· If the project hasn’t already been built, the project is first built and then run. As a result, it isn’t necessary to use the Build command before you run the program.
Murach’s Visual Basic 2008, C1 © 2008, Mike Murach & Associates, Inc. Slide 21 7 8/26/2008 Two ways to exit from a project that is running
· Click the Close button in the upper right corner of the startup form.
· Click the button control that’s designed for exiting from the application. This is typically a button that is labeled Exit, Close, or Cancel. Murach’s Visual Basic 2008, C1 © 2008, Mike Murach & Associates, Inc. Slide 22 The starting page for the Visual Studio Conversion Wizard Murach’s Visual Basic 2008, C1 © 2008, Mike Murach & Associates, Inc. Slide 23 To change the .NET Framework version for a project, click on Advanced Compile Options…
Murach’s Visual Basic 2008, C1 © 2008, Mike Murach & Associates, Inc. Slide 24 8 8/26/2008 …and choose the appropriate Framework
Murach’s Visual Basic 2008, C1 © 2008, Mike Murach & Associates, Inc. Slide 25 9 
Download