Introduction to Microsoft Visual C# |
|
Microsoft Visual C# Fundamentals |
Introduction |
Microsoft Visual C# is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems. It usually ships in two types, either by itself or as part of Microsoft Visual Studio .NET. To use the lessons on this site, you must have installed either Microsoft Visual C# .NET 2003 or Microsoft Visual Studio .NET 2003. All instructions on this site will be based on an installation of Microsoft Visual Studio .NET 2003. From now on, unless specified otherwise, we will use the expressions "Microsoft Visual C#" or "Visual C#" to refer to Microsoft Visual C# .NET 2003. After installing Microsoft Visual Studio .NET 2003, to use the programming environment, you must first open it. To do that, you would click Start -> (All) Programs -> Microsoft Visual Studio .NET 2003 -> Microsoft Visual Studio .NET 2003. |
Practical Learning: Launching Microsoft Visual C# |
After Microsoft Visual Studio has been opened, the screen you look at is called an Integrated Development Environment or IDE. The IDE is the set of tools you use to create a program. The system icon is used to identify the application that you are using. Almost every application has its own system icon. The system icon holds its own list of actions; for example, it can be used to move, minimize, maximize or close (when double-clicked) a window. When you freshly start Visual Studio, the main section of the title bar displays the name of the application as Microsoft Developer Environment. Later on, if you start a project, the title bar would display the name of your project, followed by the name of the programming environment you selected. The main section of the title bar is also used to move, minimize, maximize the top section of the IDE, or to close Visual Studio. On the right section of the title bar, there are three system buttons with the following roles:
Under the title bar, there is a range of words located on a gray bar. This is called the menu or main menu. In our lessons, the expression “Main Menu” refers to the menu on top of the IDE. To use a menu, you click one of its words and the menu expands. If an item is missing from the main menu, you can customize it. There are four main types of menus you will encounter. When clicked, the behavior of a menu that stands alone depends on the actions prior to clicking it. Under the File menu, examples include Close, Save All, or Exit. For example, if you click Close, Microsoft Visual Studio will find out whether the current file had been saved already. If it has been, the file would be closed; otherwise, you would be asked whether you want to save it before closing it. A menu that is disabled is not accessible at the moment. This kind of menu depends on another action or the availability of something else. A menu with three dots means that an intermediary action is required in order to apply its assigned behavior. Usually, this menu would call a dialog box where the user would have to make a decision. A menu with an arrow holds a list of menu items under it. A menu under another menu is called a submenu. To use such a menu, you would position the mouse on it to display its submenu. Notice that, on the main menu (and any menu), there is one letter underlined on each word. Examples are F in File, E in Edit, V in View, etc. The underlined letter is called an access key. It allows you to access the same menu item using the keyboard. In order to use an access key, the menu should have focus first. The menu is given focus by pressing either the Alt or the F10 keys. On some menu items, there is a key or a combination
of keys we call a shortcut. This key or this combination allows you to
perform the same action on that menu using the keyboard. From now on, in this book,
A toolbar is an object made of buttons. These buttons provide the same features you would get from the (main) menu, only faster. Under the main menu, the IDE is equipped with an object called the Standard toolbar. For example, to create a new project, on the main menu, you could click File -> New -> Project… On the other hand, the Standard toolbar is equipped with a button to perform the same action a little faster: By default, the Standard toolbar is positioned under the main menu but you can position it anywhere else on the IDE. To move a toolbar, position the mouse on the dotted line on its left section. The mouse pointer will change into a cross: Then click and drag away from that position: In the same way, you can position the toolbar anywhere on the screen. You can also attach or "dock" it to one of the four sides of the IDE. When a toolbar is not docked to one side of the IDE, it is said to float. When a toolbar is floating, you can resize it by dragging one of its borders. If a toolbar is floating, to put it back to its previous position, you can double-click its title bar. By default, when you start Visual Studio, it is equipped with one one toolbar: Standard. To get more toolbars, on the main menu, you can click View -> Toolbars and click the toolbar of your choice. You can also right-click any available toolbar or the main menu. This displays a list of all the available toolbars. Those that are currently opened have a check mark next to them. You can get a list of the toolbars that are available if you right-click any button on any toolbar or menu. On this site, every toolbar is referred to by its name. A toolbar is equipped with buttons that could be unfamiliar. Just looking at one is not obvious. To know what a button is used for, you can position the mouse on top of it. A tool tip will come up and display for a few seconds. From now on, each button on any toolbar will be named after its tool tip. This means that, if a tool tip displays "Hungry", its button will be called the Hungry button. If a tool tip displays "Exercises and Assignments", its button will be called the Exercises and Assignments button. If you are asked to click a button, position your mouse on different buttons until one displays the referred to name. Some buttons present an arrow on their right side. This arrow represents a menu. Like the menu, the toolbars can be customized.
This lessons assumes that you already know a good deal of the C# language, but only the language. We assume that you have no prior knowledge of graphical application programming. In our lessons, we will create Windows applications, the type referred to a graphical user interface (GUI). To create a Visual C# project, you can display the New Project dialog box, select Visual C# Projects, select the type of project, give it a name, specify its directory, and click OK.
As mentioned already, the instructions created for a Visual Basic project are written in plain English in a language easily recognizable to the human eye. To compile and execute a Visual Basic .NET project in one step, on the main menu, you can click Debug -> Start Without Debugging. Although there are other techniques or details in compiling (or debugging) and executing a project, for now, this is the only technique we will use until further notice.
As opposed to creating a new project, you can open a project that either you or someone else created. To open an existing project, on the main menu, you can click File -> Open -> Project... You can also click File -> Open Solution on the main menu. Alternatively, you can display the Start Page and click Open Open. In all cases, the action would display the Open Project dialog box. This allows you to select a Visual Project and open it. |
|
|
||
Copyright © 2004-2014 FunctionX, Inc. | Next | |
|