Saturday, February 25, 2023

Microsoft visual studio 2010 ultimate tutorial pdf free

Looking for:

Microsoft visual studio 2010 ultimate tutorial pdf free 













































   

 

Download free tutorials and courses on visual studio - Documents PDF



 

Add Ajax Control. Bhubaneswar Mobile: , Phone : Open navigation menu. Close suggestions Search Search. User Settings. Skip carousel. Carousel Previous. Carousel Next. What is Scribd? Explore Ebooks. Bestsellers Editors' Picks All Ebooks. Explore Audiobooks. Bestsellers Editors' Picks Источник статьи audiobooks.

Explore Microsoft visual studio 2010 ultimate tutorial pdf free. Editors' Picks All magazines. Explore Podcasts Смотрите подробнее podcasts. Difficulty Microsoft visual studio 2010 ultimate tutorial pdf free Intermediate Advanced. Explore Documents. Visual Studio Install Guide. Uploaded by Raj Pattanayak. Did you find this document useful? Is this content inappropriate? Report this Document. Flag for inappropriate content.

Download now. Jump to Page. Search inside document. How to Download and Install Visual Studio for. Installation of Visual Studio. Configuring observerit. MSVS Install. CSCloud Computing Lab. Cloud Computing Lab Manual-new. Install Visual Basic 6. Fuent and Gambit Installation Manual. Kolko 03 Product. Word Press Tutorial. Cloud Architecture. Lesson 1. How Do i Use Source Graph. On Directing. Nam Janak Schulzrinne Tech Report.

File List. Quick navigation Home.

❿  

Download free tutorials and courses on visual studio - Documents PDF. Microsoft visual studio 2010 ultimate tutorial pdf free



 

User Settings. Skip carousel. Carousel Previous. Carousel Next. What is Scribd? Explore Ebooks. Bestsellers Editors' Picks All Ebooks. Explore Audiobooks.

Bestsellers Editors' Picks All audiobooks. Explore Magazines. Editors' Picks All magazines. Explore Podcasts All podcasts.

Difficulty Beginner Intermediate Advanced. Explore Documents. Uploaded by Fenil Desai. Did you find this document useful? Is this content inappropriate? Report this Document. Flag for inappropriate content. Download now. For Later. Jump to Page. Search inside document. Choose help content to install on your disk for MS VS Help documentation can be selected on following help topics.

Microsoft Visual Studio. MOSS How to Dot Net Practical File. Installation of Visual Studio. Troubleshoot Volume Activation for Office Chapter 3 - Introduction to Visual Studio. Staad pro. Visual Studio Known Issues. Install SharePoint Visual Studio Readme. Office Streaming. AIK Readme. Indian Govt. Locate PF Office. Check PF Balance Online. What's New in. NET 4. Write Letter From Picture 1. Write Letter From Picture.

Missing Numbers. Match Letter From Picture 2. Match Letter From Picture 1. The condition must evaluate to either a Boolean true or false. Additionally, you can have an else clause that executes when the if condition is false. A clause is just another way to say that an item is a part of another statement. NET: Basic Syntax 59 As shown in Figure , the template brings you to a highlighted field for specifying the condition of the if statement. For C , type the condition you want evaluated and press ENTER; the snippet completes by placing your carat within the if statement block.

For VB, just place your cursor where you want to begin typing next. In C , the else statement snippet is similar to if. WriteLine "Name is Megan" ; break; default: Console. WriteLine "Unknown name" End Select In the C example, you can see the keyword switch with the value being evaluated in parentheses.

The code to execute will be based on which case statement matches the switch value. When the program executes a break statement, it stops executing the switch statement and begins executing the next statement after the last curly brace of the switch statement.

For the VB example, the Select Case statement uses name as the condition and executes code based on which case matches name. The Case Else code block will run if no other cases match. Switch Statement Snippets There are two scenarios for switch statement snippets: a minimal switch statement and an expanded switch with enum cases.

However, there is a special feature of the switch snippet that makes it even more efficient to use enums, creating a case for each enum value automatically. In the following example, we use the accountType variable of the enum type BankAccount from Listing Checking: break; case BankAccount.

Saving: break; case BankAccount. Loops You can perform four different types of loops: for, for each, while, and do. The following sections explain how loops work. For Loops For loops allow you to specify the number of times to execute a block of statements. The VB For loop initializes i as an integer, iterating repeating three times from 0 to 2, inclusive.

Although i is an integer, it will be converted to a string prior to concatenation. The C for loop snippet template is different from previous templates in that you have two fields to fill out. First, name your indexer, which defaults to i, and then press TAB, which moves the focus to the loop size field, containing Length as the placeholder. If you like the variable name i, which is an understood convention, just press the TAB key and set the length of the loop. For Each Loops For each loops let you execute a block of code on every value of an array or collection.

Arrays store objects in memory as a list. WriteLine person Next In this example, people is an array of strings that contains three specific strings of text.

The block of the loop will execute three times, once for each item in the array. Each iteration through the loop assigns the current name to person. The for each loop snippet gives you three fields to complete. The var is an implicit type specifier that allows you to avoid specifying the type of item; the compiler figures that out for you, saving you from some keystrokes. The item field will be a collection element type.

You may leave var as is or provide an explicit type, which would be string in this case. You can tab through the fields to add meaningful identifiers for the item and collection you need to iterate through.

To execute the VB For Each snippet, type? Be careful not to create endless loops. The Console. ReadLine reads the user input, which is of type string.

If the input is a string that contains only a capital Q, the loop will end. VB has another variation of loops that use the Until keyword, as follows: Do Console. For a VB Do snippet type? Figure shows an example of the Do Loop While template. Summary Working with languages is a core skill when building. NET applications. Two of the most used languages in. You learned about types, expressions, statements, code blocks, conditions, and branching.

Additionally, you learned some of the essential features of VS for writing code, such as the code editor, bookmarks, Intellisense, and snippets. Chapter 3 takes you to the next step in your language journey, teaching you about classes and the various members you can code as part of classes.

This chapter will specifically discuss the class type, which allows you to create your own custom types. Creating Classes Previously, you learned about the primitive types, which are built into languages and alias the underlying.

You can also create your own types, via classes, which you can instantiate and create objects with. The following section explains how to create a class and then instantiate an object from it. Class Syntax To create a new custom class definition, right-click the project, select Add Class, name the class Employee for this example, and type the file extension. You can add members to a class, which could be events, fields, methods, and properties. A field is a variable in a class that holds information specific to that class.

Listing shows how to instantiate an object of type Employee, which is your new custom type, and use it. You would put this code inside of Main or another method. The C new Employee or VB New Employee clause creates a new instance of Employee, and you can see that this new instance is being assigned to emp. With that new instance, via the emp variable, you can access the Employee object, including its instance members. In Listing , the FirstName field of that particular instance of Employee is assigned a string value of "Joe".

Here you see that an object can contain data. Class Inheritance One class can reuse the members of another through a feature known as inheritance. In programming terms, we say a child class can derive from a parent class and that child class will inherit members such as fields and methods of the parent class that the parent class allows to be inherited. The following example will create a Cashier class that derives from the Employee class.

To create this class, right-click the project, select Add Class, and name the class Cashier. Listing shows the new class and modifications for implementing inheritance. Listing Class inheritance C : using System; using System. In VB, you write the keyword Inherits, on a new line, followed by the class being derived from.

Essentially, this means that Cashier has all of the same members as Employee. Listing demonstrates the benefits of inheritance. Because of inheritance, Cashier automatically inherits FirstName, and the code in Listing is perfectly legal. Inheritance can be thought of as specialization in the sense that, in this example, Cashier is a specialized kind of Employee.

An instance of the Employee class would not be able to contain this information. NET Framework uses inheritance extensively to offer you reusable class libraries. Before using the class snippet, create a new class file by right-clicking the project, select Add New Item Code File, and name the file Manager.

The carat will locate to the inside of the class block. Writing Methods You can divide your algorithms into blocks of code called methods. In different programming languages, methods are called functions, procedures, or subroutines. WriteLine, where WriteLine is a method of the Console class. A method contains one or more statements. Reasons for creating methods include the ability to modularize your code, isolate complex operations in one place, or group a common operation that can be reused in multiple places.

The following sections show you how to declare and use methods. Listing will move the Console. Writeline statement from the Main method discussed in Chapter 2 into a new containing method and then add a statement to the Main method that calls the new method. Listing Declaring and calling a method C Program. WriteLine "Hello from a static method. WriteLine "Hello from an instance method.

WriteLine "Hello from a shared method. In VB, shared methods are the same as static. PrintMessageStatic has a void keyword, meaning that this method does not return a value. In VB, you indicate that a method does not return a value by making it a Sub, as was done in Listing Within the method block, you can see that there is a Console.

WriteLine statement. You can add as many statements as you need for the purpose of the method. PrintMessageShared Viewing the preceding example, which shows a statement inside of the Main method, you can see the call to Program. Notice that the class aka type that contains all the methods is named MessagePrinter.

In C , a static method is called through its containing type, which is why you call PrintMessageStatic with the Program prefix. We discuss instance methods next. The next method, PrintMessageInstance, is an instance method; it has no static modifier.

The rest of the method definition mirrors that of the PrintMessageStatic method. Using the statement new MessagePrinter creates a new instance of MessagePrinter at runtime, which is assigned to the msgPrint variable. Declaring Parameters and Passing Arguments Passing parameters to a method is a great way to make code more reusable.

For example, what if you had a method that printed a report containing the names of all customers? Listing shows a method that takes a list of customers and prints a report with customer names. Listing Declaring a method that takes parameters C Program. WriteLine title ; Console. WriteLine title Console.

WriteLine name Next End Sub End Class Parameters are a comma-separated list of identifiers, along with the type of each identifier, which clearly indicates what type of parameter the method is expecting. In Listing , the PrintCustomerReport method has two parameters: title of type string and customers of type string array.

The method displays the title in the console window when you run the program, displays a blank line, and then iterates through the list, displaying each customer name to the console. The arguments being passed, reportTitle and customerNames, match the position and types of the parameters for PrintCustomerReport, which are of the correct types that the PrintCustomerReport method is expecting.

In the preceding example, the calling code must provide arguments, actual data, for all parameters. However, you can specify parameters as being optional, allowing you to omit arguments for the optional parameters if you like.

WriteLine name Next End Sub The preceding code requires callers to pass an array of customers, but it does not require a title. When writing methods, optional parameters must be listed last. In addition to passing arguments to methods, you can receive values returned from methods.

To demonstrate the proper syntax, Listing contains a method that accepts an int and returns the squared value of that int. Calling code then assigns the return value from the method to a variable and displays the value on the console window. Create a new class named Calc. Listing Returning values from methods C Program. SquareInt 3 ; Console.

SquareInt 3 Console. Whenever you specify a return type, the method must return something whose type is the same as the return type declared. In the preceding example, the return type is declared as int; therefore, the method guarantees that the result of the calculation is type int. The Main method has a couple of statements that invoke this method and display the results to the console. In the VB example, the method is now a Function.

Notice how the function signature appends As Integer after the parameter list, which indicates that the return type of the function is Integer. NET: Types and Members 81 Coding Fields and Properties A field is a variable that is a member of a class type , as opposed to variables that are declared inside of methods, which are called local variables or locally scoped variables.

Properties are type members that give you functionality that is a cross between fields and methods. You can read and write to a property just as you can to a field. Additionally, you can define code that runs whenever you read to or write from a property, similar to methods. The following sections define fields and properties. Declaring and Using Fields As stated, a field is a variable that is a member of a class or some other container, such as a struct, which is very similar to a class.

To demonstrate how a field is declared and used, the example in Listing simulates a bank account that has a field of type decimal named currentBalance, which holds an account balance. The class has two methods: Credit and Debit. Credit increases the value of currentBalance, and Debit decreases the value of currentBalance. Listing Using fields and properties C : using System; using System. Credit m ; account. Debit 50m ; Console. CurrentBalance ; Console.

When variables like accountBalance are declared as class members, as opposed to local variables that are declared inside of method blocks, they are called fields.

The accountBalance is type decimal, which is a good choice for holding financial values. The accountBalance field has a private modifier, which means that it can only be used by members of the same class.

The implementations of Credit and Debit, respectively, increase and decrease the value of accountBalance. Main invokes Credit and Debit to change the value of the accountBalance field. Additionally, Main displays the value of accountBalance in the console window through a property named CurrentBalance.

The next section explains how the CurrentBalance property works. Declaring and Using Properties Properties are class members that you use just like a field, but the difference is that you can add specialized logic when reading from or writing to a property. When you read from a property, only the get accessor code executes, and the set accessor code only executes when you assign a value to a property. In the preceding example, the get accessor returns the value of currentBalance with no modifications.

If there were some logic to apply, like calculating interest in addition to the current balance, the get accessor might have contained the logic for that calculation prior to returning the value. The set accessor does have logic that checks the value to see if it is less than zero, which could happen if a customer overdrew his or her account. If the value is less than zero, then you could implement logic to charge the customer a fee for the overdraft. The value keyword contains the value being assigned to the property, and the previous set accessor assigns value to the accountBalance field.

The following statement from the Main method in Listing reads from CurrentBalance, effectively executing the get accessor, which returns the value of currentBalance: C : Console. CurrentBalance ; VB: Console. WriteLine statement will print the value read from CurrentBalance to the command line. Since this is so common, you can save syntax by using an automatic property, as shown in Listing Behind the scenes, the compiler produces the expanded version where the backing field is guaranteed to have a unique name to avoid conflicts.

Do not overlook that when you use automatic properties, you cannot add your own code that runs inside the get or set accessors. A C property snippet template creates an automatic property by default, but the VB snippet template is a normal property with full get and set accessors.

After learning how to create classes and use class instances, also known as objects, you learned how to add fields, methods, and properties to your class definition. The methods discussion was more in-depth, showing you how to define parameters and return values. You also learned how to define both auto-implemented and normal properties, and you learned a little about class inheritance. The next chapter moves you up a level in language skills by showing you how to create another type, called an interface.

This chapter rounds out the bare essentials of what you need to know with delegates and events, interfaces, and a quick introduction to arrays and generics. Understanding Delegates and Events Sometimes you need to write flexible code that performs general operations.

For example, when the designers of the. NET Framework created user interfaces, they added reusable controls, such as buttons, list boxes, and grids. For example, how would anyone know what we wanted our code to do when a user clicks a button on the user interface? So, these controls have interaction points built in so that they can communicate with your program; these interaction points are called events.

These events fire whenever a user performs an action such as a button click or a list box selection. We write code to hook up these events to some other code in our program that we want to run when that event happens, such as when the user clicks a button, and this is what delegates are used for. An event defines the type of notifications that a object can provide, and a delegate allows us to connect the event to the code we want to run. This section will show you the mechanics of how delegates and events work, but you should understand that the mechanics may seem somewhat abstract at first.

NET: Intermediate Syntax 91 The next section will add more logic to the set accessor in CurrentBalance in the next listing and raise an event for the calling code. Events An event is a type of class member that allows your class or class instance to notify any other code about things that happen within that class.

To help you understand the use of events, this section will associate an event with the accountBalance of an account. Listing is a modified version of Listing from Chapter 3. It additionally has an event and logic that raises the event. To see how an event can be useful, consider a program that uses a class that manages accounts. There could be different types of accounts, such as checking or savings. If a customer performs an overdraft, the consequences probably vary by what type of account is being used.

Therefore, you can give the account class an event that will fire off a notification whenever an overdraft occurs. Then, within your specialized checking account class instance, for example, you can register something called an event handler so that the instance of the class knows each time the overdraft event occurs via the handler. In Listing , the CurrentBalance property is modified to raise or fire off an OverDraft event whenever the assigned value is less than 0.

The Main method hooks up another method that will run whenever that event occurs. Listing Event demo C : using System; using System. The OverDraft event is public and is declared with the event keyword.

It defines the communication contract that must be adhered to by any code that wishes to listen for the event to fire. Look at the set accessor of the CurrentBalance property, inside of the if statement where it determines if value is less than 0. The C example has another if statement to see if the OverDraft event is equal to null. In C when an event is equal to null, it means that nothing has subscribed to be notified by the event—in essence, no other code is listening.

However, when the C event is not null, then this indicates that some code somewhere has hooked up a method to be called when the event fires. That method is said to be listening for the event. So, assuming that the caller has hooked up a method, the OverDraft event is fired. This check for null is important. If nothing is listening for the event and our code knows this to be the case when the event is null , and we raise or fire the event by calling OverDraft this, EventArgs.

Empty , an error null reference exception would occur at runtime whenever a value is set into the CurrentBalance property. The arguments to the C event mean that the current object which is the Program class instance , this, and an empty EventArgs will be passed as the event message to any other methods that were hooked up to this event.

It is interesting to note that many methods can be hooked up to your event or none at all , and each will be notified in turn when your event fires. You should start to see that events really are a form of almost spontaneous communication within your program. The preceding discussion talked about a method that is hooked up to the event and executes receives a message whenever the event fires. The next section explains how to use a delegate to specify what this method is.

The delegate specifies the allowable signature, the number of arguments, and their types, of a method that is allowed to be hooked up to the event as a listener or handler. NET Framework class library, and it, by definition, specifies that any methods hooked up to the OverDraft event must define two parameters: an object of any type and an EventArgs class.

EventHandler also specifies that the method does not return a value explicitly. If you remember, the delegate type of OverDraft is Eventhandler, which defines the precise message contract.

The next piece of the puzzle is the method to be notified when the event happens. This method is the parameter given to the new EventHandler delegate instance. Think about the GUI code that has reusable components, like buttons and list boxes. You do this through events: a Click event for the button and a SelectedItemChanged for the list box. This is the standard way that you program GUIs; you have an event and you define a method to hook up to that event so that your running program can do some work in reaction to the user.

The process takes two steps: delegate and handler creation. In Figure , you can see that Code Completion is suggesting a method name for you. Just as a delegate provides an interface to a method that is a contract basically to describe how to communicate, you can also define interfaces to classes to communicate with them in a specified way, and these are intuitively named. Implementing Interfaces Another language feature that gives you flexibility is interfaces. An interface can be useful if you want to have a group of classes that can be interchanged at any time, yet you need to write the same operations for each of these classes.

Essentially, you want to write the code that uses the class only one time, but still switch what the actual class is. The interface creates a contract that each of the interchangeable classes must adhere to. So, if the interface says that all classes that implement the interface have method A and property B, then every class that implements the interface must have method A and property B; the compiler enforces this like a contract that cannot be broken.

The following sections show you how to write an interface and then build a couple of classes that implement that interface. This definition of members is the contract of the interface.

You are the one who must to write a class that contains the members of the interface, and you must write the code that provides an implementation of the interface members. A common point of confusion is that an interface does not have any executable code, but the classes that implement the interfaces do. Name the Interface IAccount and click Add.

By standard convention, you will always name any interface class you create with a name that starts with an uppercase letter I. The following sections show you how to build the classes that implement the IAccount interface; there, you should begin to see the benefit that an interface can bring.

Name the class Checking and click Add. Using the same procedure as Checking, add another class, but name it Saving. Listings and show the two new classes. NET: Intermediate Syntax In the C listing, following the class name by a colon and then the interface name specifies that the class will implement the interface.

In reality, the code in the methods would be different for Checking and Saving because they are different account types with different business rules. The next section gives you a couple of examples to help clarify the practical use of interfaces. Writing Code That Uses an Interface One of the best ways to understand the value of interfaces is to see a problem that interfaces solve.

The particular example runs a payroll by obtaining instances of Checking and Saving classes and crediting each class, which is synonymous with employees being paid. Starting with the bad example, Listing shows how this code works. You can see how the algorithm calls GetCheckingAccounts to retrieve an array of Checking objects.

If you recall, an array is a list of elements of a specified type, that type being Checking in this case. The algorithm goes on to iterate through the Checking objects, invoking Credit on each to add to the account. Some employees want their paychecks in Checking, but others might want their paychecks to go into Saving or some other account. Therefore, the algorithm calls GetSavingsAccounts to get a list of those accounts for employees who want their paychecks to go into their savings.

The point to make here is that GetCheckingAccounts will only return Checking class instances and GetSavingsAccounts will only return Saving class instances.

Although the Credit methods of Checking and Saving should have different implementations, the code calling Credit can be the same, eliminating duplication. Listing shows how to take advantage of the fact that both Checking and Saving implement the same interface, IAccount. Looking inside of the GetAllAccounts method, you can see how an array is being built with both Checking and Saving objects.

Since Checking and Saving implement IAccount, which you saw in Listings and , instances of Checking and Saving can be directly assigned into elements of an IAccount array.

The reason you can call Credit like this is that IAccount defines a contract for the Credit method. Your code that you wrote for Checking. Credit and Saving. Credit will execute as if your code called them directly as in Listing Credit in our example, works on both Checking and Saving objects. Now you can see that interfaces help you treat different types of objects as if they were the same type and helps you simplify the code you need to write when interacting with those objects, eliminating duplication.

Imagine what would happen if you were tasked with adding more bank account types to this algorithm without interfaces; you would need to go into the algorithm to write duplicate code for each account type. However, now you can create the new account types and derive them from IAccount; the new account types automatically work in the same algorithm. Because prefixing interfaces with I is an expected convention, the template highlights the identifier after I.

NET: Intermediate Syntax Applying Arrays and Generics Whatever code you write will typically need to group objects into a single collection of that object type.

For this, you can use an array, which is a container that can have zero or many elements, each holding an instance of a particular type. There are also generic collection classes in the. NET Framework that are even more powerful than arrays. You declare a variable of the array type, instantiate the array to a specified size, and then use the array by indexing into its elements.

Listing shows an example that demonstrates the mechanics of creating and using an array. You must instantiate arrays, as is done by assigning new double[3] to stats, where 3 is the number of elements in the array. C arrays are accessed via a 0-based index, meaning that stats has three elements with indexes 0, 1, and 2.

The VB example declares stats as an array of type double. Notice that the rank of the array is 2, meaning that 2 is the highest index in the array. Since the array is 0-based, stats contains indexes 0, 1, and 2; three elements total.

Assigning values to an array means that you use the name of the array and specify the index of the element you want to assign a value to. For example, stats[0] stats 0 in VB is the first element of the stats array, and you can see from the listing how each element of the stats array is assigned the values 1.

The for loop adds each element of the array to the sum variable. Finally, you can see how to read values from an array by examining the argument to the Console. Using the element access syntax, you can see how to read a specific element from the stats array. An array is a fixed-size collection, and therefore somewhat limited in functionality.

Not all collection classes in the. NET Framework are generic collections; however, generic collections are now the preferred kind of collection to use in most cases. NET: Intermediate Syntax Coding Generics Generics are language features that allow you to write a piece of code that will work with multiple types efficiently.

A generic class definition has a placeholder for the type you want it to represent, and you use this placeholder to declare the type you want to work with. There is an entire library of generic collections in. NET as well as generic types across the entire. NET Framework Class library. Listing demonstrates how to declare a generic List. The code specifies the type of the list as a Checking account and then proceeds to populate the generic list and perform operations on the Checking elements of the generic list.

Remember to include a using directive imports for VB for the System. Generic namespace near the top within your file. Add new Checking ; checkAccts. WriteLine checkAccts[i]. Add New Checking checkAccts. Count - 1 Console. WriteLine checkAccts i. The T is a type placeholder, where you can specify any type you want. Since a list grows dynamically to accommodate any number of elements, you use the Add method to add elements to the List.

Once elements are in the List, you can use element access syntax, as shown in the for loop, to access the elements one at a time. Collections such as List are convenient because they have multiple convenience methods, such as Clear, Contains, Remove, and more.

In addition to List, the System. Generic namespace has several other generic collections, such as Dictionary, Queue, and Stack. Each generic is initialized by replacing the type parameters with the types you want to work on and then by using the specialized methods of that collection. Whenever you see the type parameter syntax, you should recognize that a generic is being used and you will have an idea of what the code means and how to read it in the documentation.

Summary What you learned in this chapter were essential skills for upcoming chapters in the rest of the book. Knowing how delegates and events work helps you with event-driven development that is common to GUI application development. Understanding interfaces directly relates to being able to build Web services, among other uses. Remember that this was only an introduction to C and VB and that there is much more to learn about these languages.

For development, you have a hierarchical structure that is flexible and allows you to organize your code in a way that makes sense for you and your team.

For deployment, you can build different project types that will result in executable or library files often referred to as assemblies that run your program when executed. Constructing Solutions and Projects With VS, you can build applications that range in size and sophistication. At the most basic level, you can start a console project that contains one or more files with code, which is very simple. At higher levels of complexity, you can build enterprise-scale applications consisting of many projects of various types, organized to support large teams of developers working in unison.

VS uses a hierarchical model to help you organize your code and gives you flexibility in how a project is set up. Some features, such as solutions and projects, are well defined, but you have the freedom to add folders that help customize the arrangement of files to meet your needs.

Two organizing principles of solution and project organization will always be true: you will work with only one solution at a time and that solution will always have one or more projects. Of course, you can always use the menu to created a new project. Chapter 2 describes the features of the New Project window. The process is the same any time you create a new project.

VS remembers your last project type, which could be helpful if you are creating multiple projects of the same type. Make sure you select Console Application as your project type. The way you create and name VB and C projects are different in that all of the decisions for C projects are made at one time, but VB divides creation into initial project creation and then saves additional information when you save the project for the first time.

In C , the Name field is the name of the project you are creating, and the Solution Name field is the name of the solution. In a multiproject solution, this might not make sense. So, first type the project name and then you can provide a name for the solution that is more appropriate.

In Figure , you can see that the project is named ProjectDemo and the solution is named SolutionDemo. VS allows you to put spaces in the names. If you have a very simple project and want all project files in the same folder, uncheck Create Directory For Solution. However, most applications you build will have multiple projects and leaving this box checked makes more sense because it maintains consistency between folder and solution organization.

In any case, when an additional project is added to your solution, VS will always put the new project into a separate subfolder. Source control is a repository for you to check code into. This is especially useful for teams where each developer can check in his or her code for a common repository of source code for this solution when you create the solution.

Click OK to create the solution. The VS Recent Projects list will have an entry with the name of the solution you just deleted, but you can click that entry and VS will recognize that the solution no longer exists, prompting you to remove the entry from the list.

Starting a new Console project in VB, you only need to provide a Name parameter, which is the name of the project to create. While other VS windows provide specialized views into specialized parts of an application, the Solution Explorer window is where you can find all of the artifacts of an application. One of the first features of the project shown in Figure is the hierarchical relationships.

You will have only one solution. You can add multiple projects to a solution, as well as folders for organizing the projects. Right-click the solution name in the Solution Explorer and select Add New Project, and you can add more projects. Add Existing Project allows you to add a project that already exists to your opened solution. The reason this option exists is that while VS solutions associate one or more projects together as a solution unit, any single project could optionally be associated with other solutions.

In other words, a single project could be shared with other solutions. Select Add New Solution Folder to add a folder to a solution. You can add a hierarchy of folders to a solution for organizing projects. If you want your file system layout to match the Solution Explorer layout with solution folders, you must create the file system folders yourself.

To avoid confusion, remember that it is possible for the physical location of projects to differ from the Solution Explorer layout. Besides organizing projects, solution folders are also useful for associating specific artifacts with your project. While solution folders are not tied to physical file system folders, they are included with source control providers, such as Visual Source Safe and Team System.

This way, whenever other members of the team check the solution out of source control, they all are working with the same files and versions. Solution folders can also be used for any type of file, including project documentation or anything else that you want to keep organized in a single place. Depending on project type, VS hides various files associated with a project.

An example of a hidden file is the bin folder hierarchy that contains the output of your project when you compile. Examining Property Settings Each project has associated settings that you can configure.

When you first create a project, these settings are configured for common values for that project type. However, you can modify these settings to meet your needs. Each project has a logical folder named Properties, shown previously in Figure , which will open a property setting window when you double-click the Properties My Project in VB folder in a project, shown in Figure There are multiple tabs, each with related properties grouped to the subject of each tab.

The following sections describe each of the features of the Application settings tab. The assembly name provides the filename for this project and defaults to the name of your project. It follows that the filename would be ProjectDemo. Had the project type been a Class Library, the filename would have been ProjectDemo. Default Namespace The Default namespace Root namespace in VB setting determines what the namespace will be defined automatically as whenever you add a new code file to your project.

If you want the namespace of new files to be different, set the namespace here. Target Framework VS has. NET Framework multitargeting support, where you can work with any version of. NET between v2. Select the. NET version you need in the Target Framework combo box. Remember to set the VB project from. NET Framework 4. Since you can have multiple versions of. NET on the same machine as VS , you can switch freely between different projects that use different. NET versions. NET 4. This might be useful for some intermediate debugging where you could emit Console.

WriteLine messages. The Startup object allows you to specify which class contains the Main method you want to use as the entry point to your application. One of the reasons you might want to do this is to start your application in different configurations, which might facilitate testing by allowing you to go straight to a part of the program without too much navigation. TIP VS ships with system icons that you can use in your own applications.

Your path might be different if you chose to install VS somewhere other than the default. The manifest describes the application and deployment features of your Click-Once application. This is an advanced technique that requires knowledge of the operating system UAC settings. Chapter 5: Creating and Building Projects If you select the Resources option, you can include a Win32 resources file, which you can then access through code in your application.

This is another advanced scenario beyond the scope of this book. This information is included in the assembly metadata when you build your project.

Most of the information in this window is self-explanatory. To see what these settings look like, press F6 to build the application, and then navigate to the location in the file system where you created the project. Right-click ProjectDemo. Referencing Assemblies All projects normally reference external assemblies.

For example, System. NET Framework assembly that contains all of the primitive. NET types and is normally included in every project. Each project type has a specific set of assemblies that appear in the References list. The assemblies that appear in this list are either required because of the type of project you are building or are optional and contain libraries that are commonly used for that type of project.

You are free to remove assembly references if you like, but be aware that removing a reference to an assembly required for that project type is likely to result in your code not being able to compile. Chapter 5: Creating and Building Projects Assembly references are added to a project to tell the compiler where to find the types it is using in an application. When your compiler runs, it will know what types you have in your code and looks through the set of referenced assemblies to find that type.

NOTE There is often confusion around the relationship between assembly references and namespaces. A namespace using statement Imports in VB allows your code to be written without fully qualifying type references for types in an assembly. However, the assembly reference is just a way to tell the compiler in which specific external assembly to look to find those types: two different purposes. Just remember to ensure that you have an assembly reference first and then add a using Imports directive at the top of your file.

Adding a. On the. Microsoft and third parties will place assemblies in the GAC to make it easier to share them by any programs. For example, if you wanted to communicate with Excel, you would click the COM tab and add a reference to the version of Microsoft Office Excel that you are working with. Adding a reference to a COM object causes VS to automatically generate a new assembly, called an Interop assembly, that has stub methods that make it easy for you to perform operations on that COM object.

The reason is that the class library project is automatically set to. The next section explains more about project references. Figure shows the VB References tab. VB includes additional functionality on the References tab. For example, you can click Add to add a reference. You also click Unused References to remove references for assemblies that are not being used in your code. Clicking Reference Paths allows you to specify a folder that VS will look in to find assemblies you want to reference.

C has a separate tab on the Properties window for managing Reference Paths. When VS looks for referenced assemblies, it will search the current project directory, then in the folders identified in Reference Paths, and then in folders for the list of assemblies specified by the Add References window. For example, you might have reusable code or want to keep your code organized into separate assemblies.

To do this, you would create Class Library projects, and then reference those class library projects from other code. You will now have two projects in your solution. This time, select the Project tab, which will contain all of the projects that belong to the same solution.

You can rename any project by right- clicking the project and selecting Rename. If you want to change the physical folder name, close the solution select File Close Solution and then change the project folder name.

To fix this, select the project in Solution Explorer and open the properties window. Using Code in Class Libraries To use class library code, you need to ensure you have a reference to the class library.

If using C , you can add a using directive, and in VB you can add an Imports directive, which allows you to use the types in the class library without fully qualifying them. After referencing the class library assembly and ensuring namespaces are managed properly, you can use class library classes and instantiate these externally referenced objects and access or invoke the members as if they were part of the code in your own assembly.

NET CLR will take care of making sure that your calls to the class library object work transparently behind the scenes. The preceding section showed you how to create the reference from one project to another, allowing the compiler to find the other assembly.

This section will explain how to write the code that specifies which objects in the class library to use. Assuming that you were building an educational application, you might have a class library that helped you keep track of students. To facilitate this scenario, you can rename the Class1. VB will make the class name change automatically, without asking.

This is a convenient way to keep your classes and filenames in sync. It is common to create only one class per file. Listing shows the new student file after renaming and adding code to make it functional. Listing Class library code C : using System; using System. Add 80 intList. Add intList.

Listing shows how. Remember that the VB namespace is implicitly set to whatever is defined as the namespace setting on the My Project page, which defaults to the project name. GetStudentGrades studentName ; Console. GetStudentGrades studentName Console. TIP The call to Console. ReadKey in Listing causes program execution to stop until the user presses a key on their keyboard. If Console. ReadKey was not present, the program would finish the Main method, which would close the application before you had the chance to see the output.

The next section explains how compiling and running works with VS. The options are scoped to either the current project or the entire solution. The top portion of the menu applies to the entire solution, and the second section is context-sensitive, applying to the currently selected project.

The following sections describe each set of options, including build, rebuild, and clean for both projects and solutions. Sometimes the build includes more than compilation. For example, if you are writing ASP. NET applications, VS will generate code based on the Web controls on the page and then that generated code will be compiled with normal code.

Therefore, the term build is more accurate than compile. During a normal build, VS will only build the items in a project or solution that are out of date. Many developers, including myself, like to pull the latest changes from source control into my solution every morning before starting work. This ensures that the current code in the solution will build with whatever was in source control.

This keeps the code in your local solution from differing too much from what is in source control. Depending on your process, you will want to test the code that was just rebuilt, prior to deployment.

The rebuild ensures that the application you are preparing for deployment is the most current. At these times, you can try a rebuild, which forces the build on all items of a project or solution. A rebuild takes more time to perform because all items in a project must be rebuilt.

If you have a small project, you might not notice the differences. However, if you have a fairly large solution, with dozens of projects, a steady pattern of rebuilds throughout the day could cut into your productivity. A rebuild on a project is often not much more work than a build on the project, but there are probably edge cases where the difference in time would be noticeable.

It is the rebuild on the solution that will most likely get your attention. That said, each version of VS has progressively improved the performance of the build process, so you should interpret the performance as a relation between build and rebuild, rather than as a statement about VS compared to any other tool. You would often perform a clean operation to guarantee that all outputs are fresh or to obtain a smaller copy of the project.

Chapter 5: Creating and Building Projects Normally, a full rebuild ensures that you have the most up-to-date outputs available. You could also perform a clean operation to ensure all outputs were removed and then perform a build to see which outputs were created.

This might give you insight into whether the build on a solution was including all of the projects. In normal circumstances, VS manages all of your dependencies for you, as described in the next section. However, in advanced scenarios, some developers might occasionally change these dependencies. Cleaning is a tool to help you know whether a project is really being built. From a practical perspective, this is rare and you could inspect file dates to tell the same thing, but cleaning is another path you can take.

A more common use of clean is to remove outputs from the project to make it smaller. You might want to compress a project or solution and e-mail it to another person, requiring that you minimize the size of the attachment.

If you perform a clean before compressing the files, you will use much less file space. Managing Dependencies and Build Order A dependency describes to VS which other projects a given project depends on to operate properly. VS adds this dependency automatically, which is good because when VS builds your solution, it will keep all projects up-to-date. VS manages a tree of dependencies.

Then, VS builds all projects that depend on the last set of projects that were rebuilt. This process continues until the entire solution is rebuilt and all projects at the top of the tree reference updated versions of all referenced projects. You can manually manage dependencies by right-clicking a project or the solution in Solution Explorer and selecting Project Dependencies. Figure shows the Project Dependencies window. In the Project Dependencies window, you can select from the drop-down list the project to set dependencies upon.

There is a list of projects that you can set dependencies on. VS created this dependency automatically. Project dependencies directly affect the build order of a project. If you recall from the previous discussion, projects that have dependencies upon them will be built before the depending projects.

From the Project Dependencies window, shown in Figure , you can click the Build Order tab to manage the order of the build. You could also get to the Build Order tab by right-clicking a project or the solution in Solution Explorer and selecting Project Build Order. You can see the Build Order tab in Figure The results could be severe in that it can take a long time to fix dependencies in a large project.

The automatic dependency management provided by VS is very dependable, and you should rely upon it whenever possible. Managing Compilation Settings The project property pages include a tab for compiler settings.

You set compiler settings for each individual project. Figure shows the C tab, which you can open by double- clicking the Properties folder on a project. Some of these settings are advanced topics that are out of the scope of this book. NET Framework System. You can also build code that depends on your own custom constants by adding your own constants to the Conditional Compilation Symbols box as a comma- separated list of strings.

C allows you to write code that is classified as unsafe, meaning that you can use pointers and other features in an unsafe context. Unsafe code is still managed code managed by the CLR. This is an advanced feature and the box is unchecked, ensuring that you must check it to opt in to enable this type of coding. All warning messages are associated with a level, and the Warning level is set to 4 by default, which includes all compiler warnings.

❿    

 

Microsoft Visual Studio 2010 - A Beginners Guide - Microsoft visual studio 2010 ultimate tutorial pdf free



    Data with the Entity Framework in Visual Studio it will show you how to do so while having more control and going through fewer manual. Instead, it is a practical hands-on programming tutorial that puts you in charge of your learning, developmental milestones, and achievements. This is a beginner's guideline for Microsoft Visual Studio Download Free PDF Figure shows that I'm installing the Ultimate version. Download free Microsoft Publisher course material, tutorial training, a PDF file on 11 pages. Size: KB; Downloads: PowerPoint An Ultimate Guide to Microsoft Visual Studio Installation with If you want to install the free trial versions of Microsoft Visual Studio ❿


No comments:

Post a Comment

Microsoft PowerPoint - Download for Mac Free

Looking for: Download powerpoint for mac free - download powerpoint for mac free.Microsoft PowerPoint Mac  Click here to DOWNLOAD      ...