Microsoft states that C# is a simple, modern,

Size: px
Start display at page:

Download "Microsoft states that C# is a simple, modern,"

Transcription

1 C H A P T E R 1 A Radically New Approach: C# and Windows Microsoft states that C# is a simple, modern, object-oriented, and type-safe programming language derived from C and C++. The first thing you will notice when using C# (C sharp) is how familiar you already are with many of the constructs of this language. Object-oriented by design, the C# language provides access to the class libraries available to Visual Basic and Visual C++ programmers. C#, however, does not provide its own class library. C# is implemented by Microsoft in the latest version of the Microsoft Visual Studio and provides access to the Next Generation Windows Services (NGWS). These services include a common execution engine for code development. Visual Studio.NET and C# The latest release of Microsoft s Visual Studio.NET provides a language-rich environment for developing a variety of applications. Programming can be done in a variety of languages, such as C, C++, C#, Visual Basic, and more. Applications can range from standalone console (command-line or DOS mode) applications to Microsoft Windows programs. C#, although certainly one of the newest variations of C to hit the market, is just a component of this much larger package. One of Microsoft s goals, in this release of the Visual Studio.NET, is to allow seamless solutions to project demands. Solutions to a task can include components from C++, Visual Basic, and C# all rolled into one seamless executable file. This book concentrates on the C# aspect of this package as it applies to creating Windows applications. If you are interested in a more detailed treatment of the C# language, we would recommend another of our books, C# Essentials, published by Prentice Hall (ISBN 1

2 2 Chapter 1 A Radically New Approach: C# and Windows X), This is just the book if you are the type of programmer who likes to discover all of nuances of a language. Our first task will be to learn how to use Visual Studio to create a simple C# console application. Then we ll do a quick study of the most important aspects of the C# language. Finally, we ll turn our attention to our first C# Windows application and see what is in store for us in the remainder of this book. Building C# Applications C# applications fall within two distinct categories: command-line or console applications and Windows applications. By using the AppWizards, you ll find that both are easy to create in terms of the template code necessary to outline a project. For our first project we build the familiar Hello World console application. We ll name this project HelloWorld. The second application, which appears closer to the end of this chapter, is called CircleArea. This is a full-fledged, object-oriented Windows application. Both projects are intended to introduce you to the Visual Studio AppWizards and show you how to build the basic template code that will be part of every project developed in this book. These are good places to set bookmarks and take notes in the margins. Your First C# Console Application To build a console application using C#, start the Visual Studio. Select the File New Project sequence to open the New Project dialog box, as shown in Figure 1 1.

3 Your First C# Console Application 3 Figure 1 1 The New Project dialog box allows us to specify a C# console application. Name this project HelloWorld, and specify a subdirectory under the root directory, as shown in Figure 1 1. When you click the OK button, the C# AppWizard creates the template code shown in Figure 1 2.

4 4 Chapter 1 A Radically New Approach: C# and Windows Figure 1 2 The AppWizard s C# template code for a console application. This template code can now be modified to suite your purposes. Figure 1 3 shows how we altered the template code for our HelloWorld project. Examine Figure 1 3 and compare it with the following complete listing. Note the addition of just one line of code: using System; namespace HelloWorld /// <summary> /// Summary description for Class1. /// </summary> class Class1 static void Main(string[] args)

5 Your First C# Console Application 5 // // TODO: Add code to start application here // Console.WriteLine("Hello C# World!"); Examine Figure 1 3, once again. Notice that the Build menu has been opened and the Rebuild option is about to be selected. Clicking this menu item will build the project. Figure 1 3 The template code is altered for the HelloWorld project.

6 6 Chapter 1 A Radically New Approach: C# and Windows When you examine this simple portion of code, you notice many of the elements that you are already familiar with from writing C or C++ console applications. Figure 1 4 shows the Debug menu opened and the Start Without Debugging option about to be selected. Make this selection to run the application within the integrated environment of the Visual Studio. Figure 1 4 Running the program from within Visual Studio. When the program is executed, a console (command-line or DOS) window will appear with the programs output. Figure 1 5 shows the output for this application. Now, let s briefly examine the familiar elements and the new additions. First, the application uses the System directive. The System namespace, provided by the NGWS at runtime, permits access to the Console class used in the Main method. The use of Console.WriteLine() is actually an abbreviated form of System.Console.WriteLine() where System represents the namespace, Console a class defined within the namespace, and WriteLine() is a static method defined within the Console class.

7 C# Programming Elements 7 Figure 1 5 The console window shows the project s output. Additional Program Details In C# programs, functions and variables are always contained within class and structure definitions and are never global. You will probably notice the use of. as a separator in compound names. C# uses this separator is place of :: and ->. Also, C# does not need forward declarations because the order in not important. The lack of #include statements is an indicator that the C# language handles dependencies symbolically. Another feature of C# is automatic memory management, which frees developers from dealing with this complicated problem. C# Programming Elements In the following sections we examine key elements of the C# language that we use throughout the book. From time to time, additional C# information is introduced, but the material in the following sections is used repeatedly.

8 8 Chapter 1 A Radically New Approach: C# and Windows Arrays C# supports the same variety of arrays as C and C++, including both single and multidimensional arrays. This type of array is often referred to as a rectangular array, as opposed to a jagged array. To declare a single-dimension integer array named myarray, the following C# syntax can be used: int[] myarray = new int[12]; The array can then be initialized with 12 values using a for loop in the following manner: for (int i = 0; i < myarray.length; i++) myarray[i] = 2 * i; The contents of the array can be written to the screen with a for loop and WriteLine() statement. for (int i = 0; i < myarray.length; i++) Console.WriteLine("myarray[0] = 1", i, myarray[i]); Note that i values will be substituted for the 0 and myarray[ ] values for 1 in the argument list provided with the WriteLine() statement. Other array dimensions can follow the same pattern. For example, the syntax used for creating a two-dimensional array can take this form: int[,] my2array = new int[12, 2]; The array can then be initialized with values using two for loops in the following manner: for (int i = 0; i < 12; i++) for (int j = 0; j < 2; j++) my2array[i, j] = 2 * i; The contents of the array can then be displayed on the console with the following syntax: for (int i = 0; i < 12; i++) for (int j = 0; j < 2; j++) Console.WriteLine("my2array[0, 1] = 2", i, j, my2array[i, j]); Three-dimensional arrays can be handled with similar syntax using this form: int[,,] my3array = new int[3, 6, 9];

9 C# Programming Elements 9 In addition to handling multidimensional rectangular arrays, C# handles jagged arrays. A jagged array can be declared using the following syntax: int[][] jagarray1; int[][][] jagarray2; For example, suppose a jagged array is declared as: int[][] jagarray1 = new int[2][]; jagarray1[0] = new int[] 2, 4; jagarray1[1] = new int[] 2, 4, 6, 8; Here jagarray1 represents an array of int. The jagged appearance of the structure gives rise to the array s type name. The following line of code would print the value 6 to the screen: Console.WriteLine(jagarray1[1][2]); For practice, try to write the code necessary to print each array element to the screen. Attributes, Events, Indexers, Properties, and Versioning Many of the terms in this section are employed when developing applications for Windows. If you have worked with Visual Basic or the Microsoft Foundation Class (MFC) and C++ you are familiar with the terms attributes, events, and properties as they apply to controls. In the following sections, we generalize those definitions even more. Attributes C# attributes allow programmers to identify and program new kinds of declarative information. For example, public, private and protected are attributes that identify the accessibility of a method. An element s attribute information can be returned at runtime using the NGWS runtime s reflection support. Events Events are used to allow classes to provide notifications about which clients can provide executable code. This code is in the form of event handlers. Again, if you have developed MFC C++ Windows code, you are already familiar with event handlers. Here is code for a button-click event handler, extracted from a project developed later in this book:

10 10 Chapter 1 A Radically New Approach: C# and Windows private void button1_click(object sender, System.EventArgs e) radius = Convert.ToDouble(textBox1.Text); textbox2.text = (radius * radius * 22 / 7).ToString(); textbox3.text = (radius * 2.0 * 22 / 7).ToString(); The event handler contains code that will be executed when a button-click event occurs. The button is a button that resides on a form in a C# Windows application. Indexers Indexers are used by C# to expose array-like data structures, such as an array of strings. This data structure might be used by a C# Windows control, such as a CheckedListBox control.... private string[] items; public string this[int index] get return items[index]; set items[index] = value; Repaint(); The CheckedListBox class can then be altered with the following code: CheckedListBox MyListBox; MyListBox[0] = "List box title"; Console.Write(MyListBox[0]); The array-like access provided by indexers is similar to the field-like access provided by properties. Properties A property is an attribute that is associated with a class or object. Windows controls offer a wide variety of changeable properties, including caption name, ID value, color, font, location, size, text, and so on. Here is a small portion of a C# Windows program that modifies the properties of a button control:

11 C# Programming Elements 11 this.button1.location = new System.Drawing.Point(152, 192); this.button1.size = new System.Drawing.Size(176, 24); this.button1.tabindex = 6; this.button1.text = "Push to Calculate"; this.button1.addonclick(new System.EventHandler(button1_Click)); Properties can be read or written to as the need arises. Versioning C# supports versioning by addressing two levels of compatibility. The first is source compatibility, which occurs when code developed on an earlier version can be simply recompiled to work on a later version. The second type of compatibility is binary compatibility, which occurs when code developed under an earlier version works under a newer version without recompiling. Boxing, Unboxing, and the Unified Type System All types in C# can be treated as objects. For example, the following line of code is acceptable in C#: Console.WriteLine(12345.ToString()); In this case the ToString() method is used on the integer by treating it as an object. An object box can be used when a value is to be converted to a reference type. This is called boxing. Unboxing is used to convert a reference type back to a value. For example: int num1 = 12345; object myobject = num1; // boxed int num2 = (int) myobject; // unboxed Here the integer number, 12345, is first converted to a reference type with the use of boxing, then converted from an object back to an integer value by casting the object (unboxing). Classes, Structures, and Enum C# provides simple, but unique, implementations to these common object-oriented features.

12 12 Chapter 1 A Radically New Approach: C# and Windows Classes C# classes allow only single inheritance. Members of a class can include constants, constructors, destructors, events, indexers, methods, properties, and operators. Each member can, in turn, have a public, protected, internal, protected internal, or private access. The makeup of a class is similar to that used in C and C++. For example: public class Form1 : System.Windows.Forms.Form // variable declaration public double radius = 7.5; /// <summary> /// Required designer variable /// </summary> private System.ComponentModel.Container components; private System.Windows.Forms.Label label1; private System.Windows.Forms.Button button1; private System.Windows.Forms.TextBox textbox1;... In this example, the class itself is public and contains a variable with public access. The designer variables, however, use a private qualifier to limit access. Classes use a pass by reference scheme as compared to a structures pass by value. For this reason, they tend to be faster than the equivalent structure. Structures Structures, as in C and C++, are very similar to classes. As a matter of fact, they can be created with members similar to those described for classes. Structures differ from classes in that they are value types with values being stored on the stack. This tends to make then slower than an equivalent class because passing by value is slower than passing by reference. Point is typically used and implemented in C, C++, and C# as a structure: struct Point public int x, y; public Point(int x, int y) this.x = x; this.y = y; This example illustrates the typical syntax for creating a structure.

13 C# Programming Elements 13 Enum The enum type declaration is used to provide a type name for a group of symbolic constants that are usually related to one another. For example: enum vehicle Chrysler, Ford, GM Use vehicle GM to access the GM element, and so on. Namespaces C# uses namespaces as an organization system applied both internally and externally. As a convention, developers usually name namespaces after the company they are developing code for. The Visual C# AppWizard uses the following convention when creating a C# console code template: using System; namespace Tester /// <summary> /// Summary description for Class1. /// </summary> class Class1 static void Main(string[] args) // // TODO: Add code to start application here // int[] myint = new int[] 1,2,3,4,5; foreach (object o in myint) Console.Write("the value of myint is: "); Console.WriteLine(o); We can modify that code to take on the following appearance:

14 14 Chapter 1 A Radically New Approach: C# and Windows using System; namespace Nineveh_National_Research.CSharp.Tester /// <summary> /// Summary description for ForEachDemo. /// </summary> class ForEachDemo static void Main(string[] args) // // TODO: Add code to start application here // int[] myint = new int[] 1,2,3,4,5; foreach (object o in myint) Console.Write("the value of myint is: "); Console.WriteLine(o); The namespace Nineveh_National_Research.CSharp.Tester is hierarchical. It really means that there is a namespace Nineveh_National_Research that contains a namespace named CSharp that itself contains a namespace named Tester. The using directive can be used as a shorthand notation instead of writing out the whole namespace name. In the previous listing, the using directive allows all of the types in System to be used without qualification. Predefined Types In addition to the value and reference types discussed in the previous section, C# provides several predefined types. For example, predefined value types include bool, byte, char, decimal, double, float, int, long, sbyte, short, uint, ulong and ushort. Table 1 1 lists and describes these types. Table 1 1 C# Predefined Types Type Description bool Boolean type; true or false, 1 or 0 byte Unsigned 8-bit integer

15 C# Programming Elements 15 Table 1 1 Type char decimal double float int long object sbyte short string uint ulong ushort C# Predefined Types (Continued) Description Unicode character 28-digit decimal type Double precision real Single precision real Signed 32-bit integer Signed 64-bit integer Base type for all other C# types Signed 8-bit integer Signed 16-bit integer A sequence of Unicode characters Unsigned 32-bit integer Unsigned 64-bit integer Unsigned 16-bit integer The types listed in the first column Table 1 1 are abbreviated versions of a longer structure name, but one preferred in C#. Statements Statement syntax in C# is basically the same as that for C and C++. In the following sections you ll see several familiar coding examples. Blocks C# allows blocking code so that one or more statements can be written in sequence. The following portion of code shows several blocks: // block 1 Console.WriteLine("This is the first block"); // block 2 Console.WriteLine("This is the second block");

16 16 Chapter 1 A Radically New Approach: C# and Windows // block 3 Console.WriteLine("This is the third block"); Any number of blocks can be created using this format. Miscellaneous Statements C# provides a number of miscellaneous statements that are listed and briefly explained in Table 1 2. Table 1 2 Statement break checked continue lock return throw try unchecked C# Miscellaneous Statements Use For exiting an enclosing do, for, foreach, switch, or while statement. Used to control the overflow checking context for arithmetic operations. All expressions are evaluated in a checked context. For starting a new iteration of a do, for, foreach, switch, or while statement. Used to obtain a mutual-exclusive lock for an object. With the lock in place, the statement will be executed then the lock will be released. Used to return control to the caller of the statement in which it appears. Used to throw an exception. Used for catching exceptions while a block is executing. Used to control the overflow checking context for arithmetic operations. All expressions are evaluated in an unchecked context. You are already familiar with a number of these statements from your work with C and C++. The do Statement A do statement continues to execute a statement until the Boolean test is false. Here is a small portion of code:

17 C# Programming Elements 17 int num1 = 0; do Console.WriteLine(num1); num1 += 2; while (num1!= 20); The output from this code will be the numbers 0 to 18. Every do statement will be executed at least one time with the Boolean test being made after the statement. The Expression Statement An expression statement evaluates a given expression and discards any value calculated in the process. Expressions such as (x + s), (y * 3), (t =2), and so on are not allowed as statements. The following is an example of an expression statement: static int HereWeGo() Console.WriteLine("We made it to HereWeGo"); return 0; static void Main(string[] args) // // TODO: Add code to start application here // HereWeGo(); Once again, the value returned by HereWeGo() is discarded. The for Statement The for statement, like its C and C++ counterparts, initializes the expression, and then executes an expression when the Boolean test is true. For example: for (int i = 0; i < 10; i++) Console.Write("the value of i is: "); Console.WriteLine(i); This portion of code will report the value of i to the screen. The value of i increments from 0 to 9 before the Boolean condition is false.

18 18 Chapter 1 A Radically New Approach: C# and Windows The foreach Statement The foreach statement is used to enumerate the contents of a collection. For example: int[] myint = new int[] 1,2,3,4,5; foreach (object o in myint) Console.Write("the value of myint is: "); Console.WriteLine(o); In this collection, each integer element will be reported to the screen. The collection, in general, can be any type. The if and if-else Statements The if statement executes based on a Boolean decision. If the statement is true, the expression will execute. If it is false, the statement will not execute. When used in conjunction with an else, the if-else combination will pass operation to the else when the if statement is false. For example: int i = 2 * 23 / 12; if ( i >= 5) Console.WriteLine("This is a big number"); else Console.WriteLine("This is a reasonable number"); This portion writes one message or another based on the calculated value of the integer result. The Label and goto Statements The goto statement is used in conjunction with a label to transfer program control. For example: goto C; A: Console.WriteLine("This should be printed last"); return 0; B: Console.WriteLine("This should be printed second"); goto A; C: Console.WriteLine("This should be printed first"); goto B;

19 C# Programming Elements 19 This concept is fairly straightforward. We recommend, however, limited use of goto statements. The switch (case-break) Statement C# switch statements, like those of C and C++, execute statements that are associated with the value of a particular expression. When no match occurs, a default condition is executed: string str = "Top"; switch (str.length) case 0: Console.WriteLine("No characters in the string."); break; case 1: Console.WriteLine("One character in the string."); break; case 2: Console.WriteLine("Two characters in the string."); break; case 3: Console.WriteLine("Three characters in the string."); break; default: Console.WriteLine("A lot of characters in the string."); break; A default option should always be provided in switch statements. The while Statement A while statement continues to execute while the Boolean result is true. For example: int i = 5; while (i <= 300) i += 5; Console.WriteLine("Not there yet!"); The value of i is initialized to 5. When the final increment is made, the value in i will be 305, and thus the loop will stop executing. The while statement continues to execute until the value of i is equal to or exceeds 300.

20 20 Chapter 1 A Radically New Approach: C# and Windows Value and Reference Types C# supports two main categories of types: value and reference types. You are already familiar with value types, including char, enum, float, int, struct, and so on. The key feature of the value type is that the variable actually contains the data Reference types, on the other hand, include class, array, delegate, and interface types. An assignment to a reference type can affect other reference types derived from that reference type. Your First C# Windows Application You are about to discover that C# Windows applications are built in an atmosphere very similar to that of Visual Basic. A C# Windows project is started in a manner similar to a console project except, of course, the Windows option is selected. Start the Visual Studio and select the File New Project menu sequence to open the New Project dialog box, as shown in Figure 1 6. Figure 1 6 The New Project dialog box for a C# Windows project.

21 Your First C# Windows Application 21 Figure 1 7 The default C# design pane for Windows projects. Name this project CircleArea and set the subdirectory off of the root directory as shown in Figure 1 6. Click Finish. The AppWizard creates the template code for the project and takes you to the design pane shown in Figure 1 7. If you are familiar with Visual Basic, you will recognize this project design area. When you build C# Windows applications, you ll graphically design forms in this designer pane. To create a working form that will eventually take on the appearance of a dialog box with controls, we need to view optional controls. We can see these controls by opening the toolbox. To do this, use the View Toolbox menu selection, as shown in Figure 1 8.

22 22 Chapter 1 A Radically New Approach: C# and Windows Figure 1 8 This option brings the toolbox to the design area. Optionally, you can select the toolbox with the Ctrl+Alt+X key sequence. When the toolbox is selected, you see a variety of controls that can be used in your form design. Figure 1 9 shows the toolbox and an altered form. To produce the altered form, shown in Figure 1 9, place the mouse over a label control in the toolbox. Hold down the left mouse button and drag the control to the form. Once on the form, the control can be moved and sized to the position shown in Figure 1 9. In a similar manner, move a button control from the toolbox to the form.

23 Your First C# Windows Application 23 Figure 1 9 An altered form with the toolbox in the left pane. Double-click the mouse on the button once it is sized and placed. This adds a Button1_Click method to the project s code that we will alter shortly. Now, we want to switch from the designer view to the code view to examine the template code written by the AppWizard. To switch to the code view, use the View Code menu sequence as shown in Figure 1 10.

24 24 Chapter 1 A Radically New Approach: C# and Windows Figure 1 10 Use the Code menu option to view the AppWizard s code. Another option is to just press F7 when in the designer view to switch to the code view. To switch from the code view back to the designer view requires just a Shift+F7 hot key combination. When you make the code view selection, you should see a project code listing very similar to the one in the following example. Note that several long lines of programming code are broken and wrapped to the next line. This is necessary because of book page restrictions. using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace CircleArea

25 Your First C# Windows Application 25 /// <summary> /// Summary description for Form1. /// </summary> public class Form1 : System.Windows.Forms.Form /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null; private System.Windows.Forms.Button button1; private System.Windows.Forms.Label label1; public double radius = 12.3; public Form1() // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after // InitializeComponent call // /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) if( disposing ) if (components!= null) components.dispose(); base.dispose( disposing ); #region Windows Form Designer generated code /// <summary> /// Required method for Designer support do /// not modify the contents of this method with

26 26 Chapter 1 A Radically New Approach: C# and Windows /// the code editor. /// </summary> private void InitializeComponent() this.components = new System.ComponentModel. Container(); this.size = new System.Drawing.Size(296, 165); this.text = "Form1"; this.label1 = new System.Windows.Forms.Label(); this.button1 = new System.Windows.Forms.Button(); label1.location = new System.Drawing. Point(40, 48); label1.text = "label1"; label1.size = new System.Drawing.Size(224, 24); label1.tabindex = 0; button1.location = new System.Drawing. Point(104, 104); button1.size = new System.Drawing.Size(88, 32); button1.tabindex = 2; button1.text = "button1"; button1.click += new System.EventHandler (this.button1_click); this.autoscalebasesize = new System.Drawing. Size(5, 13); this.controls.add (this.button1); this.controls.add (this.label1); #endregion /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() Application.Run(new Form1()); private void button1_click(object sender, System.EventArgs e) label1.text = (radius * radius * 22 / 7). ToString();

27 Your First C# Windows Application 27 All of the code you see, except for the code in boldface, was added by the AppWizard or the designer pane as you added various controls to the project. This is old news for Visual Basic programmers, but a startling surprise for C and C++ programmers! Add the code shown in boldface in the previous listing. Now use the Build Rebuild menu selection to build the application. Use the Debug Run Without Debugger menu option to execute the program code. You should see a window similar to that shown in Figure Figure 1 11 The default CircleArea project window.

28 28 Chapter 1 A Radically New Approach: C# and Windows Figure 1 12 The area of a circle is calculated. Move the mouse to button1 and click it. The application responds to this event and calculates the area of the circle for which the radius was specified in the application. Your screen should now reflect the change and appear similar to Figure The answer shown in the label is the area of a circle with a radius of All of this was accomplished by writing only two lines of code. Isn t the remainder of this book going to be fun? Additional Program Details The code in the CircleArea project is more complicated than the console application created at the beginning of this chapter. In this section, we ll examine the structure of the template code and leave the details of forms and controls for later chapters. In the following sections we ll examine key portions of the template code in an attempt to understand the structure of all C# Windows projects.

29 Your First C# Windows Application 29 Namespaces The projects namespace is named CircleArea. In the following listing, you also see additional namespaces added by the AppWizard for this C# Windows project. using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace CircleArea The System namespace is a fundamental core namespace used by all C# projects. It provides the required classes, interfaces, structures, delegates, and enumerations required of all C# applications. The System.Drawing namespace provides access to a number of drawing tools. For example, the namespace classes include Brushes, Cursor, Fonts, Pens, and so on. The namespace structures include Color, Point, and Rectangle. Do you recall the Point structure from earlier in this chapter? The namespace enumerations include BrushStyle and PenStyle. The System.Collections namespace contains the ArrayList, BitArray, Hashtable, Stack, StringCollection, and StringTable classes. The System.ComponentModel namespace provides support for the following classes; ArrayConverter, ByteConverter, DateTimeConverter, Int16Converter, Int32Converter, Int64Converter, and so on. Delegate support is also provided for a variety of event handler delegates. The System.Windows.Forms namespace provides class support for a variety of forms and controls. For example, classes are provided for Border, Button, CheckBox, CommonDialog, Forms, and ListBox. This class support spans dialog boxes, forms, and controls. Delegate support is provided for both forms and controls. Enumerations include enumerations for styles and states for forms and controls. The System.Data namespace provides class support for handling data. Enumerations allow various actions to be performed on data, including various sort options. For a more detailed look at each of these namespaces, use the Visual Studio NET Help options. Just be sure to set C# as the filter, as shown in Figure 1 13.

30 30 Chapter 1 A Radically New Approach: C# and Windows Figure 1 13 engine. Additional namespace details are available with the Visual Studio NET Help You may want to stop at this point and examine other namespaces such as Windows.Forms and so on using the Help engine. The Form The next portion of code shows the basic class for the project, named Form1. Every application uses one form, so it should not be a surprise that the naming convention for the class is the name of the base form, in this case Form1. public class Form1 : System.Windows.Forms.Form public double radius = 12.3;...

31 Your First C# Windows Application 31 /* * The main entry point for the application. * */ public static void Main(string[] args) Application.Run(new Form1()); The description for the Form1 class encompasses all of the remaining code in the project. Here you will see variable declarations, control declarations, a variety of component initializations, control methods and, of course, Main(). Designer Variables In this section, you will find listed the components that are used in the project. /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null; private System.Windows.Forms.Button button1; private System.Windows.Forms.Label label1; From our discussion of namespaces, note that the project s container is brought into the project via the System.ComponentModel namespace. In a similar manner, the Button and Label controls, named by default button1 and label1, are supported by the System.Windows.Forms namespace. Initializing Components The next portion of code initializes components for the project. Components include the form, controls placed on the form, form properties, and so on. #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() this.components = new System.ComponentModel.Container(); this.size = new System.Drawing.Size(296, 165); this.text = "Form1"; this.label1 = new System.Windows.Forms.Label(); this.button1 = new System.Windows.Forms.Button();

32 32 Chapter 1 A Radically New Approach: C# and Windows label1.location = new System.Drawing.Point(40, 48); label1.text = "label1"; label1.size = new System.Drawing.Size(224, 24); label1.tabindex = 0; button1.location = new System.Drawing.Point(104, 104); button1.size = new System.Drawing.Size(88, 32); button1.tabindex = 2; button1.text = "button1"; button1.click += new System.EventHandler (this.button1_click); this.autoscalebasesize = new System.Drawing.Size(5, 13); this.controls.add (this.button1); this.controls.add (this.label1); #endregion The components and values returned to this portion of code are dependent on the size and placement of the form and any controls placed in the form. All of this work was accomplished using the designer form. Most of these values are initial properties for the form or control they represent. For example: button1.location = new System.Drawing.Point(104, 104); button1.size = new System.Drawing.Size(88, 32); This portion of code initializes the Location and Size properties for the Button control, button1. You can view these initial property values as a static or initial form design. Many properties are changed dynamically when the program executes. In this program, for example, the text in the Label control s Text property is changed when the mouse clicks the Button control. The Event Handler You might recall that during the design phase of the project, we double-clicked the mouse twice while over the Button control. By doing so, we automatically added a template for a button1_click event to the application, as follows: private void button1_click(object sender, System.EventArgs e) label1.text = (radius * radius * 22 / 7).ToString(); This simply means that when the button is clicked, the code in this event handler is executed. The code in the event handler has nothing to do with the button event itself. The code in this example says that the Text property of the Label control, label1, will be changed to the string to the right. The string to the right of the equal sign is actually a numeric calculation for the area of a circle with the number converted to a string with the use of ToString().

33 Summary 33 The End Finally, the Dispose() method is used to clean up unneeded items: /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) if( disposing ) if (components!= null) components.dispose(); base.dispose( disposing ); The use of the Dispose() method here frees system resources. Summary This chapter has focused on the preliminary information necessary to use the Visual Studio.NET environment to build a simple console and Windows application. The chapter also provided a quick overview of the C# language, pointing out those features that will be used in the remainder of this book. Remember, if you are looking for a more detailed treatment of C# language features, you ll want to investigate our C# Essentials book, published by Prentice Hall (ISBN X), The next two chapters will concentrate on describing C# forms, controls, and properties. Once you have mastered these components, you ll be ready to start developing robust C# Windows programs.

34

Praktikum im Bereich Praktische Informatik Entwicklung eines Ray-Tracing Systems. computer graphics & visualization

Praktikum im Bereich Praktische Informatik Entwicklung eines Ray-Tracing Systems. computer graphics & visualization Praktikum im Bereich Praktische Informatik Entwicklung eines Ray-Tracing Systems Organizational Weekly Assignments + Preliminary discussion: Tuesdays 15:30-17:00 in room MI 02.13.010 Assignment deadline

More information

Systems Programming & Scripting

Systems Programming & Scripting Systems Programming & Scripting Lecture 6: C# GUI Development Systems Prog. & Script. - Heriot Watt Univ 1 Blank Form Systems Prog. & Script. - Heriot Watt Univ 2 First Form Code using System; using System.Drawing;

More information

Introduction to Java

Introduction to Java Introduction to Java The HelloWorld program Primitive data types Assignment and arithmetic operations User input Conditional statements Looping Arrays CSA0011 Matthew Xuereb 2008 1 Java Overview A high

More information

OBJECTIVE1: Understanding Windows Forms Applications

OBJECTIVE1: Understanding Windows Forms Applications Lesson 5 Understanding Desktop Applications Learning Objectives Students will learn about: Windows Forms Applications Console-Based Applications Windows Services OBJECTIVE1: Understanding Windows Forms

More information

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science First Java Programs V. Paúl Pauca Department of Computer Science Wake Forest University CSC 111D Fall, 2015 Hello World revisited / 8/23/15 The f i r s t o b l i g a t o r y Java program @author Paul Pauca

More information

Using C# for Graphics and GUIs Handout #2

Using C# for Graphics and GUIs Handout #2 Using C# for Graphics and GUIs Handout #2 Learning Objectives: C# Arrays Global Variables Your own methods Random Numbers Working with Strings Drawing Rectangles, Ellipses, and Lines Start up Visual Studio

More information

Visual Basic 2010 Essentials

Visual Basic 2010 Essentials Visual Basic 2010 Essentials Visual Basic 2010 Essentials First Edition 2010 Payload Media. This ebook is provided for personal use only. Unauthorized use, reproduction and/or distribution strictly prohibited.

More information

Using SQL Server Management Studio

Using SQL Server Management Studio Using SQL Server Management Studio Microsoft SQL Server Management Studio 2005 is a graphical tool for database designer or programmer. With SQL Server Management Studio 2005 you can: Create databases

More information

VB.NET Programming Fundamentals

VB.NET Programming Fundamentals Chapter 3 Objectives Programming Fundamentals In this chapter, you will: Learn about the programming language Write a module definition Use variables and data types Compute with Write decision-making statements

More information

Basic Java Constructs and Data Types Nuts and Bolts. Looking into Specific Differences and Enhancements in Java compared to C

Basic Java Constructs and Data Types Nuts and Bolts. Looking into Specific Differences and Enhancements in Java compared to C Basic Java Constructs and Data Types Nuts and Bolts Looking into Specific Differences and Enhancements in Java compared to C 1 Contents Hello World Program Statements Explained Java Program Structure in

More information

Appendix K Introduction to Microsoft Visual C++ 6.0

Appendix K Introduction to Microsoft Visual C++ 6.0 Appendix K Introduction to Microsoft Visual C++ 6.0 This appendix serves as a quick reference for performing the following operations using the Microsoft Visual C++ integrated development environment (IDE):

More information

Visual Logic Instructions and Assignments

Visual Logic Instructions and Assignments Visual Logic Instructions and Assignments Visual Logic can be installed from the CD that accompanies our textbook. It is a nifty tool for creating program flowcharts, but that is only half of the story.

More information

Programming and Software Development (PSD)

Programming and Software Development (PSD) Programming and Software Development (PSD) Course Descriptions Fundamentals of Information Systems Technology This course is a survey of computer technologies. This course may include computer history,

More information

Hypercosm. Studio. www.hypercosm.com

Hypercosm. Studio. www.hypercosm.com Hypercosm Studio www.hypercosm.com Hypercosm Studio Guide 3 Revision: November 2005 Copyright 2005 Hypercosm LLC All rights reserved. Hypercosm, OMAR, Hypercosm 3D Player, and Hypercosm Studio are trademarks

More information

How to test and debug an ASP.NET application

How to test and debug an ASP.NET application Chapter 4 How to test and debug an ASP.NET application 113 4 How to test and debug an ASP.NET application If you ve done much programming, you know that testing and debugging are often the most difficult

More information

The VB development environment

The VB development environment 2 The VB development environment This chapter explains: l how to create a VB project; l how to manipulate controls and their properties at design-time; l how to run a program; l how to handle a button-click

More information

Windows PowerShell Essentials

Windows PowerShell Essentials Windows PowerShell Essentials Windows PowerShell Essentials Edition 1.0. This ebook is provided for personal use only. Unauthorized use, reproduction and/or distribution strictly prohibited. All rights

More information

Programming in C# with Microsoft Visual Studio 2010

Programming in C# with Microsoft Visual Studio 2010 Course 10266A: Programming in C# with Microsoft Visual Studio 2010 Course Details Course Outline Module 1: Introducing C# and the.net Framework This module explains the.net Framework, and using C# and

More information

Windows Forms. Objectives. Windows Forms

Windows Forms. Objectives. Windows Forms Windows Forms Windows Forms Objectives Create Windows applications using the command line compiler. Create Windows applications using Visual Studio.NET. Explore Windows controls and Windows Forms. Set

More information

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program. Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to

More information

core. Volume I - Fundamentals Seventh Edition Sun Microsystems Press A Prentice Hall Title ULB Darmstadt

core. Volume I - Fundamentals Seventh Edition Sun Microsystems Press A Prentice Hall Title ULB Darmstadt core. 2008 AGI-Information Management Consultants May be used for personal purporses only or by libraries associated to dandelon.com network. Volume I - Fundamentals Seventh Edition CAY S. HORSTMANN GARY

More information

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON PROBLEM SOLVING WITH SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON Addison Wesley Boston San Francisco New York London

More information

Unleashing Hidden Powers of Inventor with the API Part 1. Getting Started with Inventor VBA Hello Inventor!

Unleashing Hidden Powers of Inventor with the API Part 1. Getting Started with Inventor VBA Hello Inventor! Unleashing Hidden Powers of Inventor with the API Part 1. Getting Started with Inventor VBA Hello Inventor! Brian Ekins Autodesk, Inc. This article provides an introduction to Inventor's VBA programming

More information

Using the Query Analyzer

Using the Query Analyzer Using the Query Analyzer Using the Query Analyzer Objectives Explore the Query Analyzer user interface. Learn how to use the menu items and toolbars to work with SQL Server data and objects. Use object

More information

Tutorial: Windows Mobile Application Development. Sybase Unwired Platform 2.1 ESD #2

Tutorial: Windows Mobile Application Development. Sybase Unwired Platform 2.1 ESD #2 Tutorial: Windows Mobile Application Development Sybase Unwired Platform 2.1 ESD #2 DOCUMENT ID: DC01285-01-0212-01 LAST REVISED: March 2012 Copyright 2012 by Sybase, Inc. All rights reserved. This publication

More information

09336863931 : provid.ir

09336863931 : provid.ir provid.ir 09336863931 : NET Architecture Core CSharp o Variable o Variable Scope o Type Inference o Namespaces o Preprocessor Directives Statements and Flow of Execution o If Statement o Switch Statement

More information

AP Computer Science Java Subset

AP Computer Science Java Subset APPENDIX A AP Computer Science Java Subset The AP Java subset is intended to outline the features of Java that may appear on the AP Computer Science A Exam. The AP Java subset is NOT intended as an overall

More information

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Handout 1 CS603 Object-Oriented Programming Fall 15 Page 1 of 11 Handout 1 Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Java

More information

This section provides a 'Quickstart' guide to using TestDriven.NET any version of Microsoft Visual Studio.NET

This section provides a 'Quickstart' guide to using TestDriven.NET any version of Microsoft Visual Studio.NET Quickstart TestDriven.NET - Quickstart TestDriven.NET Quickstart Introduction Installing Running Tests Ad-hoc Tests Test Output Test With... Test Projects Aborting Stopping Introduction This section provides

More information

How To Develop A Mobile Application On Sybase Unwired Platform

How To Develop A Mobile Application On Sybase Unwired Platform Tutorial: Windows Mobile Application Development Sybase Unwired Platform 2.1 DOCUMENT ID: DC01285-01-0210-01 LAST REVISED: December 2011 Copyright 2011 by Sybase, Inc. All rights reserved. This publication

More information

This tutorial has been prepared for the beginners to help them understand basics of c# Programming.

This tutorial has been prepared for the beginners to help them understand basics of c# Programming. 1 About the Tutorial C# is a simple, modern, general-purpose, object-oriented programming language developed by Microsoft within its.net initiative led by Anders Hejlsberg. This tutorial covers basic C#

More information

C++ INTERVIEW QUESTIONS

C++ INTERVIEW QUESTIONS C++ INTERVIEW QUESTIONS http://www.tutorialspoint.com/cplusplus/cpp_interview_questions.htm Copyright tutorialspoint.com Dear readers, these C++ Interview Questions have been designed specially to get

More information

JAVA - QUICK GUIDE. Java SE is freely available from the link Download Java. So you download a version based on your operating system.

JAVA - QUICK GUIDE. Java SE is freely available from the link Download Java. So you download a version based on your operating system. http://www.tutorialspoint.com/java/java_quick_guide.htm JAVA - QUICK GUIDE Copyright tutorialspoint.com What is Java? Java is: Object Oriented Platform independent: Simple Secure Architectural- neutral

More information

Hands-On Lab. Building a Data-Driven Master/Detail Business Form using Visual Studio 2010. Lab version: 1.0.0. Last updated: 12/10/2010.

Hands-On Lab. Building a Data-Driven Master/Detail Business Form using Visual Studio 2010. Lab version: 1.0.0. Last updated: 12/10/2010. Hands-On Lab Building a Data-Driven Master/Detail Business Form using Visual Studio 2010 Lab version: 1.0.0 Last updated: 12/10/2010 Page 1 CONTENTS OVERVIEW... 3 EXERCISE 1: CREATING THE APPLICATION S

More information

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share.

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share. LING115 Lecture Note Session #4 Python (1) 1. Introduction As we have seen in previous sessions, we can use Linux shell commands to do simple text processing. We now know, for example, how to count words.

More information

DEVELOPMENT OF A SECURE FILE TRANSFER PROTOCOL FOR AN ENTERPRISE AND CAMPUS NETWORK

DEVELOPMENT OF A SECURE FILE TRANSFER PROTOCOL FOR AN ENTERPRISE AND CAMPUS NETWORK ADVANCES IN SCIENTIFIC AND TECHNOLOGICAL RESEARCH (ASTR) VOL. 1(2), pp. 74-87, MAY 2014 REF NUMBER: ONLINE: http://www.projournals.org/astr -------------------------------------------------------------------------------------------------------------------------------

More information

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 Oct 4, 2013, p 1 Name: CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 1. (max 18) 4. (max 16) 2. (max 12) 5. (max 12) 3. (max 24) 6. (max 18) Total: (max 100)

More information

Sources: On the Web: Slides will be available on:

Sources: On the Web: Slides will be available on: C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,

More information

Java (12 Weeks) Introduction to Java Programming Language

Java (12 Weeks) Introduction to Java Programming Language Java (12 Weeks) Topic Lecture No. Introduction to Java Programming Language 1 An Introduction to Java o Java as a Programming Platform, The Java "White Paper" Buzzwords, Java and the Internet, A Short

More information

Masters programmes in Computer Science and Information Systems. Object-Oriented Design and Programming. Sample module entry test xxth December 2013

Masters programmes in Computer Science and Information Systems. Object-Oriented Design and Programming. Sample module entry test xxth December 2013 Masters programmes in Computer Science and Information Systems Object-Oriented Design and Programming Sample module entry test xxth December 2013 This sample paper has more questions than the real paper

More information

C Coding Style Guide. Technotes, HowTo Series. 1 About the C# Coding Style Guide. 2 File Organization. Version 0.3. Contents

C Coding Style Guide. Technotes, HowTo Series. 1 About the C# Coding Style Guide. 2 File Organization. Version 0.3. Contents Technotes, HowTo Series C Coding Style Guide Version 0.3 by Mike Krüger, mike@icsharpcode.net Contents 1 About the C# Coding Style Guide. 1 2 File Organization 1 3 Indentation 2 4 Comments. 3 5 Declarations.

More information

CRM Setup Factory Installer V 3.0 Developers Guide

CRM Setup Factory Installer V 3.0 Developers Guide CRM Setup Factory Installer V 3.0 Developers Guide Who Should Read This Guide This guide is for ACCPAC CRM solution providers and developers. We assume that you have experience using: Microsoft Visual

More information

Pemrograman Dasar. Basic Elements Of Java

Pemrograman Dasar. Basic Elements Of Java Pemrograman Dasar Basic Elements Of Java Compiling and Running a Java Application 2 Portable Java Application 3 Java Platform Platform: hardware or software environment in which a program runs. Oracle

More information

Introduction to Visual Studio and C#

Introduction to Visual Studio and C# Telemark University College Department of Electrical Engineering, Information Technology and Cybernetics Introduction to Visual Studio and C# HANS- PETTER HALVORSEN, 2014.03.12 Faculty of Technology, Postboks

More information

Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007

Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007 Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007 The Java Type System By now, you have seen a fair amount of Java. Time to study in more depth the foundations of the language,

More information

HOUR 3 Creating Our First ASP.NET Web Page

HOUR 3 Creating Our First ASP.NET Web Page HOUR 3 Creating Our First ASP.NET Web Page In the last two hours, we ve spent quite a bit of time talking in very highlevel terms about ASP.NET Web pages and the ASP.NET programming model. We ve looked

More information

The Photo Editor Application

The Photo Editor Application 29823 05 pp115-178 r4jm.ps 8/6/03 3:53 PM Page 115 C H A P T E R 5 The Photo Editor Application Unified Process: Elaboration Phase and Third Iteration This chapter discusses the third iteration of the

More information

Walkthrough: Creating and Using an ASP.NET Web Service in Visual Web Developer

Walkthrough: Creating and Using an ASP.NET Web Service in Visual Web Developer http://msdn.microsoft.com/en-us/library/8wbhsy70.aspx Walkthrough: Creating and Using an ASP.NET Web Service in Visual Web Developer In addition to letting you create Web pages, Microsoft Visual Studio

More information

KPN SMS mail. Send SMS as fast as e-mail!

KPN SMS mail. Send SMS as fast as e-mail! KPN SMS mail Send SMS as fast as e-mail! Quick start Start using KPN SMS mail in 5 steps If you want to install and use KPN SMS mail quickly, without reading the user guide, follow the next five steps.

More information

DATA 301 Introduction to Data Analytics Microsoft Excel VBA. Dr. Ramon Lawrence University of British Columbia Okanagan

DATA 301 Introduction to Data Analytics Microsoft Excel VBA. Dr. Ramon Lawrence University of British Columbia Okanagan DATA 301 Introduction to Data Analytics Microsoft Excel VBA Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca DATA 301: Data Analytics (2) Why Microsoft Excel Visual Basic

More information

A Step by Step Guide for Building an Ozeki VoIP SIP Softphone

A Step by Step Guide for Building an Ozeki VoIP SIP Softphone Lesson 3 A Step by Step Guide for Building an Ozeki VoIP SIP Softphone Abstract 2012. 01. 20. The third lesson of is a detailed step by step guide that will show you everything you need to implement for

More information

Introduction to Visual C++.NET Programming. Using.NET Environment

Introduction to Visual C++.NET Programming. Using.NET Environment ECE 114-2 Introduction to Visual C++.NET Programming Dr. Z. Aliyazicioglu Cal Poly Pomona Electrical & Computer Engineering Cal Poly Pomona Electrical & Computer Engineering 1 Using.NET Environment Start

More information

Data Tool Platform SQL Development Tools

Data Tool Platform SQL Development Tools Data Tool Platform SQL Development Tools ekapner Contents Setting SQL Development Preferences...5 Execution Plan View Options Preferences...5 General Preferences...5 Label Decorations Preferences...6

More information

UIL Computer Science for Dummies by Jake Warren and works from Mr. Fleming

UIL Computer Science for Dummies by Jake Warren and works from Mr. Fleming UIL Computer Science for Dummies by Jake Warren and works from Mr. Fleming 1 2 Foreword First of all, this book isn t really for dummies. I wrote it for myself and other kids who are on the team. Everything

More information

Chapter 1 Java Program Design and Development

Chapter 1 Java Program Design and Development presentation slides for JAVA, JAVA, JAVA Object-Oriented Problem Solving Third Edition Ralph Morelli Ralph Walde Trinity College Hartford, CT published by Prentice Hall Java, Java, Java Object Oriented

More information

INTRODUCTION TO OBJECTIVE-C CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 12 09/29/2011

INTRODUCTION TO OBJECTIVE-C CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 12 09/29/2011 INTRODUCTION TO OBJECTIVE-C CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 12 09/29/2011 1 Goals of the Lecture Present an introduction to Objective-C 2.0 Coverage of the language will be INCOMPLETE

More information

RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE. CISY 105 Foundations of Computer Science

RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE. CISY 105 Foundations of Computer Science I. Basic Course Information RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE CISY 105 Foundations of Computer Science A. Course Number and Title: CISY-105, Foundations of Computer Science B. New

More information

Android Studio Application Development

Android Studio Application Development Android Studio Application Development Belén Cruz Zapata Chapter No. 4 "Using the Code Editor" In this package, you will find: A Biography of the author of the book A preview chapter from the book, Chapter

More information

Introduction to Visual Studio 2010

Introduction to Visual Studio 2010 Introduction If you haven t used Microsoft Visual Studio before, then this tutorial is for you. It will walk you through the major features of Visual Studio 2010 and get you started with creating various

More information

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection

More information

The C Programming Language course syllabus associate level

The C Programming Language course syllabus associate level TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming

More information

Ambientes de Desenvolvimento Avançados

Ambientes de Desenvolvimento Avançados Ambientes de Desenvolvimento Avançados http://www.dei.isep.ipp.pt/~jtavares/adav/adav.htm Aula 17 Engenharia Informática 2006/2007 José António Tavares jrt@isep.ipp.pt 1.NET Web Services: Construção de

More information

3 IDE (Integrated Development Environment)

3 IDE (Integrated Development Environment) Visual C++ 6.0 Guide Part I 1 Introduction Microsoft Visual C++ is a software application used to write other applications in C++/C. It is a member of the Microsoft Visual Studio development tools suite,

More information

MS Access Lab 2. Topic: Tables

MS Access Lab 2. Topic: Tables MS Access Lab 2 Topic: Tables Summary Introduction: Tables, Start to build a new database Creating Tables: Datasheet View, Design View Working with Data: Sorting, Filtering Help on Tables Introduction

More information

Select the Crow s Foot entity relationship diagram (ERD) option. Create the entities and define their components.

Select the Crow s Foot entity relationship diagram (ERD) option. Create the entities and define their components. Α DESIGNING DATABASES WITH VISIO PROFESSIONAL: A TUTORIAL Microsoft Visio Professional is a powerful database design and modeling tool. The Visio software has so many features that we can t possibly demonstrate

More information

Visual Basic. murach's TRAINING & REFERENCE

Visual Basic. murach's TRAINING & REFERENCE TRAINING & REFERENCE murach's Visual Basic 2008 Anne Boehm lbm Mike Murach & Associates, Inc. H 1-800-221-5528 (559) 440-9071 Fax: (559) 440-0963 murachbooks@murach.com www.murach.com Contents Introduction

More information

Step 2: Headings and Subheadings

Step 2: Headings and Subheadings Step 2: Headings and Subheadings This PDF explains Step 2 of the step-by-step instructions that will help you correctly format your ETD to meet UCF formatting requirements. Step 2 shows you how to set

More information

Moving from CS 61A Scheme to CS 61B Java

Moving from CS 61A Scheme to CS 61B Java Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you

More information

NUMBER SYSTEMS APPENDIX D. You will learn about the following in this appendix:

NUMBER SYSTEMS APPENDIX D. You will learn about the following in this appendix: APPENDIX D NUMBER SYSTEMS You will learn about the following in this appendix: The four important number systems in computing binary, octal, decimal, and hexadecimal. A number system converter program

More information

public static void main(string[] args) { System.out.println("hello, world"); } }

public static void main(string[] args) { System.out.println(hello, world); } } Java in 21 minutes hello world basic data types classes & objects program structure constructors garbage collection I/O exceptions Strings Hello world import java.io.*; public class hello { public static

More information

Xcode Project Management Guide. (Legacy)

Xcode Project Management Guide. (Legacy) Xcode Project Management Guide (Legacy) Contents Introduction 10 Organization of This Document 10 See Also 11 Part I: Project Organization 12 Overview of an Xcode Project 13 Components of an Xcode Project

More information

Hands-On Lab. Client Workflow. Lab version: 1.0.0 Last updated: 2/23/2011

Hands-On Lab. Client Workflow. Lab version: 1.0.0 Last updated: 2/23/2011 Hands-On Lab Client Workflow Lab version: 1.0.0 Last updated: 2/23/2011 CONTENTS OVERVIEW... 3 EXERCISE 1: DEFINING A PROCESS IN VISIO 2010... 4 Task 1 Define the Timesheet Approval process... 4 Task 2

More information

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. Exam Name MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) The JDK command to compile a class in the file Test.java is A) java Test.java B) java

More information

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement?

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement? 1. Distinguish & and && operators. PART-A Questions 2. How does an enumerated statement differ from a typedef statement? 3. What are the various members of a class? 4. Who can access the protected members

More information

Appendix M: Introduction to Microsoft Visual C++ 2010 Express Edition

Appendix M: Introduction to Microsoft Visual C++ 2010 Express Edition Appendix M: Introduction to Microsoft Visual C++ 2010 Express Edition This book may be ordered from Addison-Wesley in a value pack that includes Microsoft Visual C++ 2010 Express Edition. Visual C++ 2010

More information

'========================================================================== ==== Scans a range of A/D Input Channels

'========================================================================== ==== Scans a range of A/D Input Channels ========================================================================== ==== File: Library Call Demonstrated: background mode Purpose: continuously array. Demonstration: channels. Other Library Calls:

More information

Object Oriented Software Design

Object Oriented Software Design Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa September 14, 2011 G. Lipari (Scuola Superiore Sant Anna) Introduction

More information

Web Services in.net (1)

Web Services in.net (1) Web Services in.net (1) These slides are meant to be for teaching purposes only and only for the students that are registered in CSE4413 and should not be published as a book or in any form of commercial

More information

CS 111 Classes I 1. Software Organization View to this point:

CS 111 Classes I 1. Software Organization View to this point: CS 111 Classes I 1 Software Organization View to this point: Data Objects and primitive types Primitive types operators (+, /,,*, %). int, float, double, char, boolean Memory location holds the data Objects

More information

Introduction to the use of the environment of Microsoft Visual Studio 2008

Introduction to the use of the environment of Microsoft Visual Studio 2008 Steps to work with Visual Studio 2008 1) Start Visual Studio 2008. To do this you need to: a) Activate the Start menu by clicking the Start button at the lower-left corner of your screen. b) Set the mouse

More information

Creating Database Tables in Microsoft SQL Server

Creating Database Tables in Microsoft SQL Server Creating Database Tables in Microsoft SQL Server Microsoft SQL Server is a relational database server that stores and retrieves data for multi-user network-based applications. SQL Server databases are

More information

Crash Course in Java

Crash Course in Java Crash Course in Java Based on notes from D. Hollinger Based in part on notes from J.J. Johns also: Java in a Nutshell Java Network Programming and Distributed Computing Netprog 2002 Java Intro 1 What is

More information

Fast Arithmetic Coding (FastAC) Implementations

Fast Arithmetic Coding (FastAC) Implementations Fast Arithmetic Coding (FastAC) Implementations Amir Said 1 Introduction This document describes our fast implementations of arithmetic coding, which achieve optimal compression and higher throughput by

More information

Java CPD (I) Frans Coenen Department of Computer Science

Java CPD (I) Frans Coenen Department of Computer Science Java CPD (I) Frans Coenen Department of Computer Science Content Session 1, 12:45-14:30 (First Java Programme, Inheritance, Arithmetic) Session 2, 14:45-16:45 (Input and Programme Constructs) Materials

More information

JetBrains ReSharper 2.0 Overview Introduction ReSharper is undoubtedly the most intelligent add-in to Visual Studio.NET 2003 and 2005. It greatly increases the productivity of C# and ASP.NET developers,

More information

Demo: Controlling.NET Windows Forms from a Java Application. Version 7.3

Demo: Controlling.NET Windows Forms from a Java Application. Version 7.3 Demo: Controlling.NET Windows Forms from a Java Application Version 7.3 JNBridge, LLC www.jnbridge.com COPYRIGHT 2002 2015 JNBridge, LLC. All rights reserved. JNBridge is a registered trademark and JNBridgePro

More information

VB.NET INTERVIEW QUESTIONS

VB.NET INTERVIEW QUESTIONS VB.NET INTERVIEW QUESTIONS http://www.tutorialspoint.com/vb.net/vb.net_interview_questions.htm Copyright tutorialspoint.com Dear readers, these VB.NET Interview Questions have been designed specially to

More information

Getting Started with the Internet Communications Engine

Getting Started with the Internet Communications Engine Getting Started with the Internet Communications Engine David Vriezen April 7, 2014 Contents 1 Introduction 2 2 About Ice 2 2.1 Proxies................................. 2 3 Setting Up ICE 2 4 Slices 2

More information

Code::Blocks Student Manual

Code::Blocks Student Manual Code::Blocks Student Manual Lawrence Goetz, Network Administrator Yedidyah Langsam, Professor and Theodore Raphan, Distinguished Professor Dept. of Computer and Information Science Brooklyn College of

More information

UML Class Diagrams (1.8.7) 9/2/2009

UML Class Diagrams (1.8.7) 9/2/2009 8 UML Class Diagrams Java programs usually involve multiple classes, and there can be many dependencies among these classes. To fully understand a multiple class program, it is necessary to understand

More information

Programming Languages CIS 443

Programming Languages CIS 443 Course Objectives Programming Languages CIS 443 0.1 Lexical analysis Syntax Semantics Functional programming Variable lifetime and scoping Parameter passing Object-oriented programming Continuations Exception

More information

Computing Concepts with Java Essentials

Computing Concepts with Java Essentials 2008 AGI-Information Management Consultants May be used for personal purporses only or by libraries associated to dandelon.com network. Computing Concepts with Java Essentials 3rd Edition Cay Horstmann

More information

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

KITES TECHNOLOGY COURSE MODULE (C, C++, DS) KITES TECHNOLOGY 360 Degree Solution www.kitestechnology.com/academy.php info@kitestechnology.com technologykites@gmail.com Contact: - 8961334776 9433759247 9830639522.NET JAVA WEB DESIGN PHP SQL, PL/SQL

More information

Keywords are identifiers having predefined meanings in C programming language. The list of keywords used in standard C are : unsigned void

Keywords are identifiers having predefined meanings in C programming language. The list of keywords used in standard C are : unsigned void 1. Explain C tokens Tokens are basic building blocks of a C program. A token is the smallest element of a C program that is meaningful to the compiler. The C compiler recognizes the following kinds of

More information

Chapter 2 Introduction to Java programming

Chapter 2 Introduction to Java programming Chapter 2 Introduction to Java programming 1 Keywords boolean if interface class true char else package volatile false byte final switch while throws float private case return native void protected break

More information

Compute Cluster Server Lab 3: Debugging the parallel MPI programs in Microsoft Visual Studio 2005

Compute Cluster Server Lab 3: Debugging the parallel MPI programs in Microsoft Visual Studio 2005 Compute Cluster Server Lab 3: Debugging the parallel MPI programs in Microsoft Visual Studio 2005 Compute Cluster Server Lab 3: Debugging the parallel MPI programs in Microsoft Visual Studio 2005... 1

More information

Java Application Developer Certificate Program Competencies

Java Application Developer Certificate Program Competencies Java Application Developer Certificate Program Competencies After completing the following units, you will be able to: Basic Programming Logic Explain the steps involved in the program development cycle

More information

Java Interview Questions and Answers

Java Interview Questions and Answers 1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write and compile the java

More information

Lab 9 Access PreLab Copy the prelab folder, Lab09 PreLab9_Access_intro

Lab 9 Access PreLab Copy the prelab folder, Lab09 PreLab9_Access_intro Lab 9 Access PreLab Copy the prelab folder, Lab09 PreLab9_Access_intro, to your M: drive. To do the second part of the prelab, you will need to have available a database from that folder. Creating a new

More information