Object-Oriented Programming in Visual Basic

Size: px
Start display at page:

Download "Object-Oriented Programming in Visual Basic"

Transcription

1 Object-Oriented Programming in Visual Basic Dana L. Wyatt Robert J. Oberg Student Guide Revision 2.1 Object Innovations Course 420

2 Object-Oriented Programming in Visual Basic Rev. 2.1 Student Guide Information in this document is subject to change without notice. Companies, names and data used in examples herein are fictitious unless otherwise noted. No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without the express written permission of Object Innovations. Product and company names mentioned herein are the trademarks or registered trademarks of their respective owners. Copyright 2006 Object Innovations All rights reserved. Object Innovations Printed in the United States of America. Rev. 2.1 Copyright 2006 Object Innovations ii

3 Table of Contents (Overview) Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 Chapter 12 Chapter 13 Appendix A.NET: What You Need to Know Fundamentals of Visual Basic Programming Control Structures Procedures Advanced Data Types Exception Handling Object-Oriented Programming Inheritance Interfaces and Collections Introduction to Windows Forms Windows Forms Controls User Interface Features Database Programming Learning Resources Electronic File Supplements Supplement1.pdf Using Visual Studio 2005 Rev. 2.1 Copyright 2006 Object Innovations iii

4 Directory Structure The course software installs to the root directory c:\oic\introvb. Example programs for each chapter are in named subdirectories of chapter directories Chap01, Chap02, and so on. The Labs directory contains one subdirectory for each lab, named after the lab number. Starter code is frequently supplied, and answers are provided in the chapter directories. The CaseStudy directory contains a case study in multiple steps. The Demos directory is provided for performing in-class demonstrations led by the instructor. Supplementary course content is provided in a PDF file in the Supplements directory. Code examples for the supplement are in the directory Supp1. Data files install to the directory c:\oic\data. Rev. 2.1 Copyright 2006 Object Innovations iv

5 Table of Contents (Detailed) Chapter 1.NET: What You Need to Know... 1 Getting Started... 3.NET: What Is Really Happening... 4.NET Programming in a Nutshell... 5.NET Program Example... 6 Viewing the Assembly... 7 Viewing Intermediate Language... 8 Understanding.NET... 9 Visual Studio Visual Basic 2005 Express Edition Creating a Console Application Saving Your Project Visual Studio Solutions Starter Code Using the Visual Studio Text Editor IntelliSense Build and Run the Project Pausing the Output Visual Basic and GUI Programs NET Documentation Summary Chapter 2 Fundamentals of Visual Basic Programming Visual Basic Hello, World Compiling, Running (Command Line) Program Structure Namespaces Project Imports Startup Object Naming Standards Keywords Multiple-File Program Structure Using Procedures Data Types IEEE 754 Floating Point Standard Data Type Ranges Literals Variables Initialization of Variables Type Checking Weak Type Checking Example Constants Rev. 2.1 Copyright 2006 Object Innovations v

6 Data Conversions Operators and Expressions Arithmetic Operators String Operators Relational Operators Logical Operators Bitwise Operators Assignment Operators Operator Precedence Console I/O Console Input Console Output Placeholders A Practical Example Lab Summary Chapter 3 Control Structures Control Structures If/Then Statement If/Then/Else Statement Payroll Example Select Case Statement Lab 3A Looping Do/Loop Statement Leap Year Example Exiting Do Loops Prematurely While Statement For/Next Statement A Random Number Example Lab 3B Continue Statement Summary Chapter 4 Procedures Modules Subroutines ByVal Parameters ByRef Parameters Functions A Game Example Access, Modules, and Scope Scope Scope Example Part Scope Example Part Scope Example Part Static Variables Rev. 2.1 Copyright 2006 Object Innovations vi

7 Overloading Optional Parameters Variable Length Parameter Lists Lab 4A Lab 4B Summary Chapter 5 Advanced Data Types Arrays Initializing Arrays Using UBound An Example Using Arrays Multi-Dimensional Arrays Arrays are a Reference Type Reference Assignment Issues Jagged Arrays An Example Using Jagged Arrays Dynamic Arrays Releasing Memory for the Array System.Array System.Array Functions Lab 5A Enumerations System.Enum System.Enum Functions Structures With Statement Structure Assignment An Example Using Structures Lab 5B Pass-by-Value versus Pass-by-Reference Value Types vs. Reference Types Value Types vs. Reference Types Using ByVal with Value Types Using ByRef with Value Types Using ByVal with Reference Types Summary Chapter 6 Exception Handling Handling Errors Visual Basic Exception Handling Exception Message Demo System.Exception Exception Flow of Control Handling Multiple Exceptions Throwing Exceptions Types of Exceptions Context and Stack Unwinding Exception Handling Strategies Rev. 2.1 Copyright 2006 Object Innovations vii

8 Fahrenheit/Celsius Version Fahrenheit/Celsius Version Fahrenheit/Celsius Version Fahrenheit/Celsius Version Inner Exceptions Custom Exceptions Lab Summary Chapter 7 Object-Oriented Programming Object-Oriented Programming Objects in Software Abstraction and Encapsulation Classes Defining a Class in Visual Basic Defining Data Members Defining Methods Creating Objects Using Objects Assigning Object References Garbage Collection Me Properties Defining Properties ReadOnly Properties WriteOnly Properties Shared Attributes Shared Methods and Properties An Arithmetic Calculator Example Constructors and Initialization Defining Constructors Default Constructor Shared Constructor Constructor Examples ReadOnly Members Constant Members Events Defining Events Restrictions on Event Procedures Raising Events Trapping Events Using WithEvents Trapping Events Dynamically A Banking Example ToString in User-Defined Classes Lab Summary Rev. 2.1 Copyright 2006 Object Innovations viii

9 Chapter 8 Inheritance Inheritance Inheritance Hierarchy Defining a Derived Class A Simple Example: Types of People NET s Object Class Controlling Base Class Construction Derived Class Construction Derived Class Constructors Need For Protected Access Modifier Access Control Using Protected Access Exceptions Defining Custom Exceptions Using Custom Exceptions Shadowing Base Class Methods Polymorphism Defining a Method as Overridable Overriding a Method Using Heterogeneous Collections with Polymorphic Methods Abstract Classes Not Inheritable Classes Type Conversions in Inheritance CType Lab Summary Chapter 9 Interfaces and Collections Components and OO in Visual Basic Interfaces Interfaces in Visual Basic Implementing an Interface Using an Interface Multiple Interfaces Using Multiple Interfaces TypeOf... Is and Dynamic Interfaces Interfaces in Visual Basic and COM Resolving Ambiguity in Interfaces NET Interfaces Arrays of User-Defined Objects Implementing IComparable Lab 9A Collections ArrayList ArrayList Methods Example: StringList IEnumerable and IEnumerator Rev. 2.1 Copyright 2006 Object Innovations ix

10 Using Enumerators Collections of User-Defined Objects Account Class Collection Interfaces ICollection IList Default Properties Using the Item Property Lab 9B Writing Generic Code Using a Class of Object Generic Types Generic Example Generic Client Code System.Collections.Generic Lab 9C Summary Chapter 10 Introduction to Windows Forms Windows Forms Creating a Windows Forms App Aligning Controls Setting the Tab Order Partial Classes Windows Forms Event Handling Add Events for a Control Events using the Wizard Bar Events Documentation Closing a Form ListBox Control ListBox Example My Command Line Arguments Lab Summary Chapter 11 Windows Forms Controls Common Properties Common Events Event Handling Sample Controls Using a Label Using Mnemonics Using a Text Box Using a Button Lab 11A Using a Radio Button and Group Box Using a Check Box Rev. 2.1 Copyright 2006 Object Innovations x

11 Using the ToolTip Control Lab 11B Using a ListBox Control Adding ListBox Items Removing ListBox Items Selecting an Item in a List Box Using a ComboBox Control Flexible Events Handlers Timer Control Lab 11C Summary Chapter 12 User Interface Features Dialog Boxes MessageBox Custom Dialogs Adding a Custom Dialog Using DialogResult Displaying a Dialog Tab Order and Focus Initializing a Custom Dialog Changing the Behavior of a Button s DialogResult Lab 12A Modeless Dialogs Managing the Relationship between Forms Programming the Apply and Close Buttons Enabling / Disabling the Apply Button Common Dialogs Using a Common Dialog Control Menus MenuStrip Control A Calculator Example Application Calculator Starter Code Attaching a Menu to a Form Configuring Items in a Menu Testing the Menu Responding to Menu Events Changing Menu Item Appearance Modified SetOperation() ContextMenuStrip Control Example: Integrating a Context Menu into an Application Context Menu Events Handling Multiple Events Lab 12B Summary Chapter 13 Database Programming ADO.NET Rev. 2.1 Copyright 2006 Object Innovations xi

12 ADO.NET Architecture NET Data Providers Programming with ADO.NET Interfaces NET Namespaces Connected Data Access Sample Database Example: Connecting to SQL Server ADO.NET Class Libraries Connecting to an OLE DB Data Provider Using Commands Creating a Command Object ExecuteNonQuery Using a Data Reader Data Reader: Code Example Lab 13A Disconnected Datasets Data Adapters Data Bound Controls DataGridView Control DataGridView Sample Program DataGridView Demo Performing a Query Lab 13B Summary Appendix A Learning Resources Rev. 2.1 Copyright 2006 Object Innovations xii

13 IntroVb Chapter 1 Chapter 1.NET: What You Need to Know Rev. 2.1 Copyright 2006 Object Innovations 1

14 IntroVb Chapter 1.NET: What You Need to Know Objectives After completing this unit you will be able to: Describe the essentials of creating and running a program in the.net environment. Build and run a simple Visual Basic program in the.net environment. Use the ILDASM tool to view intermediate language. Use Visual Studio 2005 or Visual Basic 2005 Express Edition as an effective environment for creating Visual Basic programs. Use the.net Framework SDK documentation. Rev. 2.1 Copyright 2006 Object Innovations 2

15 IntroVb Chapter 1 Getting Started From a programmer s perspective, a beautiful thing about.net is that you scarcely need to know anything about it to start writing programs for the.net environment. You write a program in a high-level language (such as Visual Basic), a compiler creates an executable.exe file (called an assembly), and you run that.exe file. Even very simple programs, if they are designed to do something interesting, such as perform output, will require that the program employ the services of library code. A large library, called the.net Framework Class Library, comes with.net, and you can use all of the services of this library in your programs. Rev. 2.1 Copyright 2006 Object Innovations 3

16 IntroVb Chapter 1.NET: What Is Really Happening The assembly that is created does not contain executable code, but, rather, code in Intermediate Language, or IL (sometimes called Microsoft Intermediate Language, or MSIL). In the Windows environment, this IL code is packaged up in a standard portable executable (PE) file format, so you will see the familiar.exe extension (or, if you are building a component, the.dll extension). You can view an assembly using the ILDASM tool. When you run the.exe, a special runtime environment (the Common Language Runtime, or CLR) is launched and the IL instructions are executed by the CLR. Unlike some runtimes, where the IL would be interpreted each time it is executed, the CLR comes with a just-in-time (JIT) compiler, which translates the IL to native machine code the first time it is encountered. On subsequent calls, the code segment runs as native code. Rev. 2.1 Copyright 2006 Object Innovations 4

17 IntroVb Chapter 1.NET Programming in a Nutshell 1. Write your program in a high-level.net language, such as Visual Basic. 2. Compile your program into IL. 3. Run your IL program, which will launch the CLR to execute your IL, using its JIT to translate your program to native code as it executes. We will look at a simple example of a Visual Basic program, and run it under.net. Don t worry about the syntax of Visual Basic, which we will start discussing in the next chapter. Rev. 2.1 Copyright 2006 Object Innovations 5

18 IntroVb Chapter 1.NET Program Example See SimpleCalc in the Chap01 folder. 1. Enter the program in a text editor. ' SimpleCalc.vb ' ' This program does a simple calculation: calculate ' area of a rectangle Module SimpleCalc Sub Main () Dim base As Integer = 20 Dim height As Integer = 5 Dim area As Integer area = base * height System.Console.WriteLine("Area = {0}", area) End Sub End Module 2. Compile the program at the command line. Start the console window via Start All Programs Microsoft Visual Studio 2005 Visual Studio Tools Visual Studio 2005 Command Prompt. >vbc SimpleCalc.vb 3. Run your IL program SimpleCalc.exe >SimpleCalc area = 100 If you are using Visual Basic 2005 Express Edition, see the note on page 11 about using command-line tools. Rev. 2.1 Copyright 2006 Object Innovations 6

19 IntroVb Chapter 1 Viewing the Assembly You can view the assembly using the ILDASM tool. >ildasm SimpleCalc.exe Rev. 2.1 Copyright 2006 Object Innovations 7

20 IntroVb Chapter 1 Viewing Intermediate Language Double-click on Main:void() Rev. 2.1 Copyright 2006 Object Innovations 8

21 IntroVb Chapter 1 Understanding.NET The nice thing about a high-level programming language is that you usually do not need to be concerned with the platform on which the program executes. You can work with the abstractions provided by the language and with functions provided by libraries. Your appreciation of the Visual Basic programming language and its potential for creating great applications will be richer if you have a general understanding of.net. After this course, we suggest you next study: 422.NET Framework Using Visual Basic And then, depending on your interests: 423 ADO.NET Using Visual Basic 424 XML Programming Using Visual Basic and.net 425 Windows Forms Using Visual Basic 426 ASP.NET Using Visual Basic 428 Web Services Using Visual Basic and ASP.NET Rev. 2.1 Copyright 2006 Object Innovations 9

22 IntroVb Chapter 1 Visual Studio 2005 While it is possible to write Visual Basic programs using any text editor, and compile them with the command-line compiler, it is very tedious to program that way. An IDE makes the process of writing software much easier. An IDE provides convenience items, such as a syntaxhighlighting editor. An IDE reduces the tedium of keeping track of configurations, environment settings and file organizations. You may use Visual Studio 2005 throughout this course to create and compile your Visual Basic programs. Visual Studio 2005 is discussed in more detail in Supplement1.pdf. This supplement also discusses the low cost version Visual Basic 2005 Express Edition. Rev. 2.1 Copyright 2006 Object Innovations 10

23 IntroVb Chapter 1 Visual Basic 2005 Express Edition Microsoft has made available free versions of its Visual Studio 2005 developer tools. Download Visual Basic 2005 Express Edition from: If you want to use command-line tools, you will need to manually place a couple of directories in your Path variable. The compiler vbc.exe is in this folder on the drive where Windows is installed, with the proper version of.net specified: \WINDOWS\Microsoft.NET\Framework\v The tool ildasm.exe is in this folder on the drive where Visual Basic 2005 Express Edition is installed: \Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin You can edit the Path environment variable from the Advanced tab of the System applet in the Control Panel. Rev. 2.1 Copyright 2006 Object Innovations 11

24 IntroVb Chapter 1 Creating a Console Application We will now create a simple console application. Our program is the same simple calculator we created earlier that was compiled at the command line. 1. From the Visual Basic 2005 Express Edition main menu, choose File New Project... This will bring up the New Project dialog. 2. For Templates, choose ConsoleApplication. 3. In the Name field, type SimpleCalcVs. See below. Click OK. Rev. 2.1 Copyright 2006 Object Innovations 12

25 IntroVb Chapter 1 Saving Your Project Notice Solution Explorer in the top-right. The project shows a single file Module1.vb. Click on the project SimpleCalcVs. Before proceeding, save your project. From main menu, choose File Save SimpleCalcVs As. Click the Browse button and navigate to the Location C:\OIC\IntroVb\Demos. Make sure the Name is SimpleCalcVs and that the Create directory for solution check box is cleared. Click Save. Rev. 2.1 Copyright 2006 Object Innovations 13

26 IntroVb Chapter 1 Visual Studio Solutions In Visual Studio 2005, project information is organized by solutions and projects. A solution, specified by a.sln file, consists of one or more projects, specified by.vbproj files in the case of Visual Basic. Visual Basic 2005 Express Edition by default does not show the solution, only projects. You can have the solution shown by choosing Tools Options from the main menu. Check Always show solution in the General section of the Projects and Solutions options. For the sake of clarity, we ll show solutions in this course. Rev. 2.1 Copyright 2006 Object Innovations 14

27 IntroVb Chapter 1 Starter Code Back to our demo, we see that a Visual Studio solution has been created with one project. The project contains two elements. The folder MyProject contains a number of files that we normally will not need to touch. Module1.vb contains skeleton code that we will edit. Rev. 2.1 Copyright 2006 Object Innovations 15

28 IntroVb Chapter 1 Using the Visual Studio Text Editor In Solution Explorer, change the name of the file Module1.vb to SimpleCalc.vb. Other changes will be made for you automatically, such as changing the name of the module to SimpleCalc. Make the following edits, using the Visual Studio text editor. Module SimpleCalc Sub Main() Dim base As Integer = 20 Dim height As Integer = 5 Dim area As Integer area = base * height System.Console.WriteLine("Area = {0}", area) End Sub End Module Notice that the Visual Studio text editor highlights syntax, indents automatically, and so on. In Visual Basic, as opposed to Visual C#, the editor does other things for you too, such as supply matching End keywords, adjust capitalization of keywords, and so on. Rev. 2.1 Copyright 2006 Object Innovations 16

29 IntroVb Chapter 1 IntelliSense A powerful feature of Visual Studio is IntelliSense. IntelliSense will automatically pop up a list box allowing you to easily insert language elements directly into your code. Rev. 2.1 Copyright 2006 Object Innovations 17

30 IntroVb Chapter 1 Build and Run the Project Building a project means compiling the individual source files and linking them together with any library files to create an IL executable.exe file. You can build the project by using one of the following: Menu Build Build Solution Toolbar Keyboard shortcut Ctrl + Shift + B You can run the program without the debugger by using one of the following: Toolbar (This toolbar button is not provided by default; see Appendix A for how to add it to your Build toolbar.) Keyboard shortcut Ctrl + F5 You can run the program in the debugger by using one of the following: Menu Debug Start Debugging Toolbar Keyboard shortcut F5 Try it! Rev. 2.1 Copyright 2006 Object Innovations 18

31 IntroVb Chapter 1 Pausing the Output If you run the program in the debugger from Visual Studio, you will notice that the output window automatically closes on program termination. To keep the window open, you may prompt the user for some input. Module SimpleCalc Sub Main() Dim base As Integer = 20 Dim height As Integer = 5 Dim area As Integer area = base * height System.Console.WriteLine("Area = {0}", area) System.Console.WriteLine( _ "Prese Enter to exit") System.Console.ReadLine() End Sub End Module This version of the program is saved as a Visual Studio 2005 project in Chap01\SimpleCalcVs. Remember that you can always make the console window stay open by running without the debugger via Control + F5. Rev. 2.1 Copyright 2006 Object Innovations 19

32 IntroVb Chapter 1 Visual Basic and GUI Programs Microsoft s Visual Basic language works very effectively in a GUI environment. Using Windows Forms, it is easy to create Windows GUI programs in Visual Basic. Example: See Chap01\SimpleCalcGui We will discuss GUI programming using Visual Basic beginning in Chapter 10. Rev. 2.1 Copyright 2006 Object Innovations 20

33 IntroVb Chapter 1.NET Documentation.NET Framework documentation is included with Visual Studio Use the menu Help Contents. Rev. 2.1 Copyright 2006 Object Innovations 21

34 IntroVb Chapter 1 Summary As in other environments, with.net you write a program in a high-level language, compile to an executable (.EXE file), and run that.exe file. The.EXE file, called an assembly, contains Intermediate Language instructions. You can view an assembly through the ILDASM tool. Visual Studio 2005 is a powerful IDE that makes it easy to develop Visual Basic programs. A free version, Visual Basic 2005 Express Edition, can be downloaded from Microsoft s Web site. With Visual Studio 2005, it is easy to create GUI programs using Visual Basic. You can access extensive.net Framework documentation through the Visual Studio help system. Rev. 2.1 Copyright 2006 Object Innovations 22

35 IntroVb Chapter 3 Chapter 3 Control Structures Rev. 2.1 Copyright 2006 Object Innovations 75

36 IntroVb Chapter 3 Control Structures Objectives After completing this unit you will be able to: Use conditional statements such as If and Select that available in Visual Basic. Use looping statements such as Do While and For that are available in Visual Basic. You can immediately exit a loop with Exit. You can skip to the next iteration of a loop with Continue. Rev. 2.1 Copyright 2006 Object Innovations 76

37 IntroVb Chapter 3 Control Structures Visual Basic has a powerful set of control statements and functions that include: CONDITIONAL If statement Select statement LOOPING Do/Loop statement For statement Rev. 2.1 Copyright 2006 Object Innovations 77

38 IntroVb Chapter 3 If/Then Statement The simplest form of the If/Then statement in Visual Basic is used to execute a statement, or set of statements, when a condition is true The single-line versions of the If can be used for simple situations If a < 0 Then a = 0 If employeetype = "Salaried" _ Then grosspay = 40 * payrate However, this shortened version does not lend itself well to maintainability. The multi-line version of the If is more flexible and requires an End If statement. If employeetype = "Salaried" Then grosspay = 40 * payrate End If If plancode <> 5 Then rate = plancode * 9.95 Console.WriteLine("Basic rate is {0}", rate) End If The conditional expression may use any of the relational or logical operators discussed the previous chapter. If insuranceinforce And deductiblepaid > 1000 Then fullycovered = True coveredamount = cost End If Rev. 2.1 Copyright 2006 Object Innovations 78

39 IntroVb Chapter 3 If/Then/Else Statement The If/Else statement can be used to indicate that different actions must be taken depending on whether a condition is true ' Single line version If units < 0 Then stat = "Invalid" Else stat = "OK" ' Multi-line version If employeetype = "Salaried" Then grosspay = 40 * payrate Else grosspay = hoursworked * payrate End If If statements may be nested to make a decision between a set of possible choices. When statements are nested, each If statement must be considered as being unique and each requires its own End If. If studentclassification = "undergraduate" Then tuition = credithours * 80 Else If studentclassification = "graduate" Then tuition = credithours * 90 Else If studentclassification = "nondegree" Then tuition = credithours * 65 Else tuition = 0 Console.WriteLine( _ "Invalid classification!") End If End If End If Exit Sub ' exits the procedure Rev. 2.1 Copyright 2006 Object Innovations 79

40 IntroVb Chapter 3 If/Then/Else Statement (Cont'd) The If/ElseIf statement can be used in place of the nested If/Else statements. Only one End If is required. If classification = "undergraduate" Then tuition = credithours * 80 ElseIf classification = "graduate" Then tuition = credithours * 90 ElseIf classification = "nondegree" Then tuition = credithours * 60 Else tuition = 0 Console.WriteLine("Invalid classification!") Exit Sub ' exits the procedure End If Rev. 2.1 Copyright 2006 Object Innovations 80

41 IntroVb Chapter 3 Payroll Example This program calculates an employee's gross pay. See the example program Payroll. The user is prompted for employee data that includes: Pay rate Number of hours worked Whether the employee is eligible for the bonus program The rules to used to calculate gross pay include: Pay overtime after 40 hours. If the employee is eligible for the bonus program and has worked at least 40 hours that week, add a 5 percent bonus to the gross pay. ' Payroll calculator Module Payroll Sub Main() Dim payrate As Decimal Dim hrsworked As Single Dim eligibleforbonus As String Dim grosspay As Decimal Console.Write("Enter pay rate: ") payrate = _ Convert.ToDecimal(Console.ReadLine()) Console.Write("Eligible for bonus (y/n): ") Rev. 2.1 Copyright 2006 Object Innovations 81

42 IntroVb Chapter 3 Payroll Example (Cont'd) eligibleforbonus = Console.ReadLine() Console.Write("Enter hours worked: ") hrsworked = _ Convert.ToSingle(Console.ReadLine()) If hrsworked <= 40 Then grosspay = hrsworked * payrate Else grosspay += _ (hrsworked - 40) * 0.5 * payrate If eligibleforbonus = "y" Then grosspay *= 1.05 ' 5% bonus End If End If Console.WriteLine("Gross pay: {0,8:c}", _ grosspay) End Sub End Module The output might resemble the following: Enter pay rate: 10 Eligible for bonus (y/n): y Enter hours worked: 45 Gross pay: $ Rev. 2.1 Copyright 2006 Object Innovations 82

43 IntroVb Chapter 3 Select Case Statement The Select statement is used to specify an action determined by a set of values The value of the variable determines which case is executed. Case statements may contain a single value or a list of values. Select Case city Case "Norman", "Tulsa" state = "Oklahoma" Case "Los Angeles", "San Francisco", "Stockton" state = "California" Case "Baltimore", "Greenbelt", "St. Mary's City" state = "Maryland" Case Else state = "*Unknown*" End Select Case statements may also contain a range of values or use a relational operator Select Case testscore Case 100 ' single value grade = "A+" Case Is >= 92 ' Is <operator> value grade = "A" Case 90, 91 ' list of values grade = "A-" Case 88 To 89 ' range of values grade = "B+" Case Else grade = "Who cares!" End Select Rev. 2.1 Copyright 2006 Object Innovations 83

44 IntroVb Chapter 3 Lab 3A Cell Phone Bill Calculations In this lab, you will calculate the amount due for a cell phone bill based on a plan and the number of minutes used. Detailed instructions are contained in the Lab 3A write-up at the end of the chapter. Suggested time: 45 minutes Rev. 2.1 Copyright 2006 Object Innovations 84

45 IntroVb Chapter 3 Looping There are two basic types of loops. A pre-test loop tests the condition before the body of the loop is executed. It is possible, using a pre-test loop, that the body of the loop might never be executed. A post-test loop tests the condition after the body of the loop is executed. The number of iterations in a post-test loop is at least one. Visual Basic provides several forms of looping constructs that include both pre-test and post-test abilities. Rev. 2.1 Copyright 2006 Object Innovations 85

46 IntroVb Chapter 3 Do/Loop Statement The Do/Loop is the primary looping construct used in Visual Basic. There are two forms of the Do/Loop. The Do While statement is used to loop through a set of code while some condition is true. Console.Write("Enter a number(<0 to stop): ") num = Convert.ToInt32(Console.ReadLine()) Do While num >= 0 sum += num Console.Write("Enter a number(<0 to stop): ") num = Convert.ToInt32 (Console.ReadLine()) Loop Console.WriteLine("The sum is {0}", sum) The Do Until statement, is used to loop through a set of code until some condition is true. Console.Write("Enter a number (<0 to stop): ") num = Convert.ToInt32(Console.ReadLine()) Do Until num < 0 sum += num Console.Write("Enter a number(<0 to stop): ") num = Convert.ToInt32 (Console.ReadLine()) Loop Console.WriteLine("The sum is {0}", sum) Both versions are pre-test loop constructs. A pre-read (one that appears before the condition) is necessary so that, if the first number the user enters is negative, we can immediately stop the loop. Rev. 2.1 Copyright 2006 Object Innovations 86

47 IntroVb Chapter 3 Do/Loop Statement (Cont'd) There are post-test versions of the Do While and Do Until statements. The condition is placed after the Loop keyword instead of the Do keyword. Do Console.Write("Enter a number (<0 to stop): ") num = Convert.ToInt32(Console.ReadLine()) If num > 0 Then sum += num End If Loop While num > 0 Console.WriteLine("The sum is {0}", sum) Do Console.Write("Enter a number (<0 to stop): ") num = Convert.ToInt32(Console.ReadLine()) If num > 0 Then sum += num End If Loop Until num < 0 Console.WriteLine("The sum is {0}", sum) Notice that we had to use an If after the ReadLine to make sure we didn't process the stop condition. These looping examples are illustrated in two versions of the SumOfNumbers program. Rev. 2.1 Copyright 2006 Object Innovations 87

48 IntroVb Chapter 3 Leap Year Example The LeapYear program calculates whether a given year is a leap year. Any year evenly divisible by 4 is a leap year except those years that are also evenly divisible by 100. One exception: If the year is evenly divisible by 400, it is a leap year. ' Leap year calculator Module LeapYear Sub Main() Dim year As Integer Dim goagain As String Do Console.Write("Enter a year: ") year = Convert.ToInt32(Console.ReadLine()) If year Mod 4 = 0 And (year Mod 100 <> 0 _ Or year Mod 400 = 0) Then Console.WriteLine( _ "{0} is a leap year", year) Else Console.WriteLine( _ "{0} is not a leap year", year) End If Console.Write( _ "Do you want to try another (y/n)? ") goagain = Console.ReadLine() Loop While goagain = "y" End Sub End Module Rev. 2.1 Copyright 2006 Object Innovations 88

49 IntroVb Chapter 3 Leap Year Example (Cont'd) The output might resembles the following: Enter a year: is not a leap year Do you want to try another (y/n)? y Enter a year: is not a leap year Do you want to try another (y/n)? y Enter a year: is a leap year Do you want to try another (y/n)? y Enter a year: is a leap year Do you want to try another (y/n)? n Rev. 2.1 Copyright 2006 Object Innovations 89

50 IntroVb Chapter 3 Exiting Do Loops Prematurely Any Do/Loop may be exited prematurely by using the Exit Do statement. When this statement is executed, execution is immediately transferred to the first statement following the Loop keyword. See LeapYear\Version2. Do Console.Write("Enter a year: ") year = CInt(Console.ReadLine()) If year < 0 Then Console.WriteLine( _ "Invalid year... terminating!") Exit Do End If ' Calculate whether the year is a leap ' year and print the results Console.Write( _ "Do you want to try another (y/n)? ") goagain = Console.ReadLine() Loop While goagain = "y" Rev. 2.1 Copyright 2006 Object Innovations 90

51 IntroVb Chapter 3 While Statement Another version of a pre-test while loop is the While statement. It has roots in earlier versions of VB. It has been retained for compatibility reasons. This statement functions exactly like its corresponding Do/Loop statement. The Exit While statement provides an early exit from the While. While num >= 0 Console.Write("Enter a number(<0 to stop): ") num = Convert.ToInt32(Console.ReadLine()) If num < 0 Then Exit While sum += num End While Console.WriteLine("The sum is {0}", sum) Rev. 2.1 Copyright 2006 Object Innovations 91

52 IntroVb Chapter 3 For/Next Statement The For/Next statement is a looping construct that is used when the number of times that the body of the loop executes is fixed. The statement initializes a counter variable to a starting value, specifies an ending value, and an increment If the increment value is positive, the loop executes if the counter is <= the ending value. For year = 1776 To 2038 Step 4 Console.WriteLine("{0} is an election year", _ year) Next If the increment is negative, the loop executes if the counter is >= the ending value. For countdown = 10 To 1 Step Next If the increment is omitted, it is assumed to have the value 1. For index = 1 To 5... Next The Exit For statement to exit early from a For loop. For i = 1 To 100 answer = Console.ReadLine() If answer = "Q" Or answer = "q" Then Exit For ' calculations go here Next Rev. 2.1 Copyright 2006 Object Innovations 92

53 IntroVb Chapter 3 A Random Number Example The LuckyGuess program selects a random number between 1 and 10 and gives the user three chances to guess the number. Hints such as Too low and Too high are displayed after each guess if the user is unsuccessful. Rnd() returns a random number between 0 and 1. To scale it to a number in a specified range, you must use the following formula: Int (lowerbound + Rnd() * upperbound) Int() truncates the fractional part of the number. The algorithm used by Rnd() generates pseudo-random numbers. To generate different sequences each time the program is executed, you must initialize the generator by calling the Randomize() function. ' Lucky Guess Module LuckyGuess Sub Main() Dim randomnumber As Integer Dim chance, guess As Integer ' Initialize the random number generator Randomize() ' Calculate a random number between 1 and 10 randomnumber = Int( * Rnd()) ' Give the user three chances Rev. 2.1 Copyright 2006 Object Innovations 93

54 IntroVb Chapter 3 A Random Number Example (Cont'd) For chance = 1 To 3 ' Get their guess Console.WriteLine( _ "Enter guess #{0}: ", chance) guess = _ Convert.ToInt32(Console.ReadLine()) ' Determine how accurate their guess was If guess = randomnumber Then Console.WriteLine( _ "Congratulations! You found it!") Exit For ElseIf guess < randomnumber Then Console.WriteLine("Too low!") Else Console.WriteLine("Too high!") End If Next Console.WriteLine( _ "The number was {0}", randomnumber) End Sub End Module One possible set of output from running this program is shown here: Enter guess #1: 6 Too high! Enter guess #2: 1 Too low! Enter guess #3: 2 Too low! The number was 4 Rev. 2.1 Copyright 2006 Object Innovations 94

55 IntroVb Chapter 3 A Random Number Example (Cont'd) Another possible set of output from running this program could be: Enter guess #1: 7 Too high! Enter guess #2: 3 Congratulations! You found it! The number was 3 Rev. 2.1 Copyright 2006 Object Innovations 95

56 IntroVb Chapter 3 Lab 3B Food Orders In this lab, you will build a program that processes food orders at a fast food restaurant. Detailed instructions are contained in the Lab 3B write-up at the end of the chapter. Suggested time: 45 minutes Rev. 2.1 Copyright 2006 Object Innovations 96

57 IntroVb Chapter 3 Continue Statement Visual Basic 2005 has a Continue statement, which will immediately skip to the next iteration of a For, Do, or While statement. See the example program LoopContinue. Dim array As Integer() = _ {2, 3, 5, 7, 11, 13, 17, 19} For i As Integer = 0 To array.length - 1 Console.Write(array(i) & " ") Next i Console.WriteLine("") Dim iw As InputWrapper = New InputWrapper() Do Dim target As Integer = iw.getint("target: ") Dim found As Boolean = False If target < 0 Then Console.WriteLine("NEGATIVE") Continue Do End If For i As Integer = 0 To array.length - 1 If array(i) = target Then found = True Exit For End If Next i If found Then Console.WriteLine("FOUND") Else Console.WriteLine("NOT FOUND") End If Loop While iw.getstring("more (y/n): ").Equals("y") Rev. 2.1 Copyright 2006 Object Innovations 97

58 IntroVb Chapter 3 Summary Visual Basic has a number of control structures that support structured programming. Conditional statements include If and Select. Looping statements include Do, For and While. With the Exit statement you can immediately exit a loop. With the Continue statement you can immediately skip to the next iteration in a loop. Rev. 2.1 Copyright 2006 Object Innovations 98

59 IntroVb Chapter 3 Introduction Lab 3A Cell Phone Bill Calculations In this lab, you will build a program that calculates a cell phone bill given a plan type and information about the minutes used during the month. Suggested Time: Root Directory: Work Directory: Solutions Directory: 45 minutes OIC\IntroVb Labs\Lab3A Chap03\PhoneCharges\Version1 Instructions 1. Create a new Visual Basic Console Application and name it PhoneCharges. Change the module file name to PhoneCharges.vb. 2. Prompt the user for the user's plan type. Allowable plan types are: 1 - $9.95/month. No free minutes. $0.20/minute for all calls. 2 - $29.95/month. 200 free anytime minutes. $0.25/minute for excess minutes. 3 - $44.95/month. 400 free anytime minutes. $0.25/minute for first 200 excess minutes. $0.22/minute for all other excess minutes. 4 - $59.95/month. 800 free anytime minutes. $0.22/minute for first 400 excess minutes. $0.20/minute for all other excess minutes. 5 - $99.95/month free anytime minutes. $0.20/minute for excess minutes. 3. Prompt the user for the number of minutes used. 4. Calculate the charges for the month. 5. Add in a 2.75% federal CPM tax and a 5.25% state sales tax. 6. Display the monthly service charge, number of excess minutes and the charge for those minutes, the CPM tax, the sales tax, and the total due. 7. Build and test your application. Rev. 2.1 Copyright 2006 Object Innovations 99

60 IntroVb Chapter 3 Introduction Lab 3B Food Orders In this lab, you will design a program that accepts a food order at a restaurant. The user will be prompted (repetitively) for the item(s) they want to order. You program will look up the price of each item and add it to the cumulative order total. When the user enters TOTAL, your program will stop prompting the user and print the total due for the order. Suggested Time: Root Directory: Work Directory: Solutions Directory: 45 minutes OIC\IntroVb Labs\Lab3B Chap03\FoodOrder Instructions 1. Create a new Visual Basic Console Application and name it FoodOrder. Change the module file name to FoodOrder.vb. 2. Prompt the user for the first item they want to order. Allowable items, and associated prices, are: ITEM PRICE Burger $2.25 Cheeseburger $2.75 Fries $1.50 Soda $1.25 Milkshake $ Display the price of the item, or an error message if it is not in the list, and add the price to the cumulative order total. 4. Repeat steps 2 3 until the user enters TOTAL as the item description. 5. Display the cumulative order total. Build and test your application. Rev. 2.1 Copyright 2006 Object Innovations 100

61 IntroVb Chapter 10 Chapter 10 Introduction to Windows Forms Rev. 2.1 Copyright 2006 Object Innovations 359

62 IntroVb Chapter 10 Introduction to Windows Forms Objectives After completing this unit you will be able to: Use Visual Studio 2005 to implement a simple graphical user interface with Windows Forms and basic controls. Use partial classes to organize class code over multiple files. Explain the principles of event handling in Windows Forms and implement handlers for simple control events. Use a ListBox control to display a list of objects. Use the built-in object My to access information about the application and its runtime environment. Rev. 2.1 Copyright 2006 Object Innovations 360

63 IntroVb Chapter 10 Windows Forms Windows Forms is that part of the.net Framework that supports building traditional GUI applications on the Windows platform. Windows Forms provides a large set of classes that make it easy to create sophisticated user interfaces. These classes are available to all.net languages. Your Visual Basic Windows application will typically have a main window that is implemented by building a class derived from System.Windows.Forms.Form. Object Control ScrollableControl ContainerControl Form UserControl Your Form Rev. 2.1 Copyright 2006 Object Innovations 361

64 IntroVb Chapter 10 Creating a Windows Forms App It is easy to create a Windows Forms application using the Form Designer in Visual Studio 2005 or Visual Basic 2005 Express Edition. This same Form Designer is available to all.net languages. We ll illustrate the use of Visual Basic 2005 Express Edition. 1. Create a new Visual Basic project BankGui of type Windows Application. 2. In Solution Explorer, click on the project, and then save the project under the name BankGui in the Demos directory. Do not create a separate directory for the solution. Rev. 2.1 Copyright 2006 Object Innovations 362

65 IntroVb Chapter 10 Windows Forms Demo (Cont d) 3. From the toolbox, drag two labels, two textboxes, and two buttons to the form. Use the resizing handles to resize the form. 4. Enter property values for the form, textboxes and buttons: Name Form1 txtamount txtbalance cmddeposit cmdwithdraw Text Bank Account (blank) (blank) Deposit Withdraw 5. Add event handlers for the buttons by double-clicking on each button. 6. Add an event handler for the Form s Load event by doubleclicking over any empty area of the form. Rev. 2.1 Copyright 2006 Object Innovations 363

66 IntroVb Chapter 10 Windows Forms Demo (Cont d) 7. Add the following code: Public Class Form1 Private Sub cmddeposit_click(byval sender As _ System.Object, ByVal e As System.EventArgs) _ Handles cmddeposit.click Dim amount As Integer = _ Convert.ToInt32(txtAmount.Text) Dim balance As Integer = _ Convert.ToInt32(txtBalance.Text) balance += amount txtbalance.text = Convert.ToString(balance) End Sub Private Sub cmdwithdraw_click(byval sender As _ System.Object, ByVal e As System.EventArgs) _ Handles cmdwithdraw.click Dim amount As Integer = _ Convert.ToInt32(txtAmount.Text) Dim balance As Integer = _ Convert.ToInt32(txtBalance.Text) balance -= amount txtbalance.text = Convert.ToString(balance) End Sub Private Sub Form1_Load(ByVal sender As _ System.Object, ByVal e As System.EventArgs) _ Handles MyBase.Load txtamount.text = "25" txtbalance.text = "100" End Sub End Class Rev. 2.1 Copyright 2006 Object Innovations 364

67 IntroVb Chapter 10 Windows Forms Demo (Cont d) 8. Build and run the application. It should behave like a standard Windows application. The completed demo is in the BankGui\Step1 directory for this chapter. Rev. 2.1 Copyright 2006 Object Innovations 365

68 IntroVb Chapter 10 Aligning Controls As you drag controls onto a form using the Visual Studio 2005 Form Designer, you will see alignment lines displayed automatically. This makes it easy to lay out controls in a neat way. The Layout toolbar can be used to align two or more controls, to make two or more controls the same size, to control the distance between two or more controls, and so on. Slide the mouse cursor over the buttons to see the yellow tool tip, which describes the function of the button. Rev. 2.1 Copyright 2006 Object Innovations 366

69 IntroVb Chapter 10 Setting the Tab Order You can set the tab order of the controls on the form using the View Tab Order menu. Your form must have the focus for the Tab Order option to appear on the View menu. It displays the form and places numbers representing the current tab order over each control. As you click on the controls, the tab order changes -- the first control you click on becomes number 0, the second control you click on becomes number 1, and so on. When you are finished, use the View Tab Order menu to make the numbers go away. Rev. 2.1 Copyright 2006 Object Innovations 367

70 IntroVb Chapter 10 Partial Classes In.NET 2.0, you can split the definition of a class over two or more source files. Use the Partial keyword modifier. Code maintenance can be simplified for large classes. The Windows Form Designer generates partial classes. The boiler plate code generated by the Form Designer is kept in one file, which is not touched by the programmers. Code added by the programmer is maintained in another file. ' Form1.Designer.vb Partial Class Form1 Inherits System.Windows.Forms.Form... Private Sub InitializeComponent() Me.cmdWithdraw = _ New System.Windows.Forms.Button Me.cmdDeposit = _ New System.Windows.Forms.Button Me.txtBalance = _ New System.Windows.Forms.TextBox... Rev. 2.1 Copyright 2006 Object Innovations 368

71 IntroVb Chapter 10 Windows Forms Event Handling GUI applications are event-driven, in which the application executes code in response to user events, such as clicking the mouse, choosing a menu item, etc. Each form or control has a predefined set of events. For example, every button has a Load event. Windows Forms uses the.net event model, which uses delegates to bind events to the methods that handle them. When an event occurs in an application, the control raises the event by calling the delegate for that event. The delegate then calls all of the methods it is bound to. The Forms Designer code uses static event handling ' In Form1.Designer.vb Private WithEvents cmdwithdraw _ As System.Windows.Forms.Button ' In Form1.vb Private Sub cmdwithdraw_click(byval sender As _ System.Object, ByVal e As System.EventArgs) _ Handles cmdwithdraw.click... Rev. 2.1 Copyright 2006 Object Innovations 369

72 IntroVb Chapter 10 Add Events for a Control Every control has a primary event. You can add a handler for this event by double-clicking on the control in the Visual Studio 2005 Form Designer. We added a handler for the Deposit and Withdraw buttons in this way. You can add other events by selecting the in the Properties window and double-clicking on a selected event. This technique is the same as in Visual C# and is new for Visual Basic with Visual Studio Rev. 2.1 Copyright 2006 Object Innovations 370

73 IntroVb Chapter 10 Events using the Wizard Bar Visual Studio 2005 still supports the technique of adding events using the wizard bar at the top of the code window. Select an object and the appropriate event. A skeletal version of the event handler will be added. Rev. 2.1 Copyright 2006 Object Innovations 371

74 IntroVb Chapter 10 Events Documentation You can find all of the events associated with a class in the.net Framework Reference. This screen shot shows documentation for the FormClosing event of the Form class. Rev. 2.1 Copyright 2006 Object Innovations 372

75 IntroVb Chapter 10 Closing a Form A form may be closed in a number of ways, such as by clicking the at the top-right, using the system menu at the top-left, pressing Alt+F4, and so on. In all cases, the FormClosing event will be fired, providing an opportunity to cancel the closing. Continuing our simple Bank Account form demo, add the following code to the handler of the FormClosing event. See BankGui\Step2. Private Sub Form1_FormClosing( _ ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) _ Handles Me.FormClosing Dim result As DialogResult = MessageBox.Show( _ "Do you really want to close?", _ "Bank Account", MessageBoxButtons.YesNo) If result <> DialogResult.Yes Then e.cancel = True End If End Sub The following dialog will be displayed: Rev. 2.1 Copyright 2006 Object Innovations 373

76 IntroVb Chapter 10 ListBox Control The.NET Framework provides a number of controls that you can use to display lists of items to the user. These controls also allow the user to select an item from the list, typically by clicking on the item to be selected. The simplest list control is the ListBox control. The collection Items maintains a collection of object references. There are methods such as Add, Remove and Clear. The property SelectedItem gets or sets the currently selected item in the listbox. Perform a cast to get out an item of a particular type. The property SelectedIndex gets or sets the zero-based index of the currently selected item ( 1 if no item is selected). The event SelectedIndexChanged is fired when the user selects a new index. There are many more properties, methods, and events, which you can study from the documentation. Rev. 2.1 Copyright 2006 Object Innovations 374

77 IntroVb Chapter 10 ListBox Example The program ListBoxDemo illustrates maintaining a list of strings in a listbox. Private Sub cmdadd_click(byval sender As _ System.Object, ByVal e As System.EventArgs) _ Handles cmdadd.click listbox1.items.add(txtstring.text) End Sub Private Sub cmdremove_click(byval sender As _ System.Object, ByVal e As System.EventArgs) _ Handles cmdremove.click listbox1.items.remove(txtstring.text) End Sub Private Sub listbox1_selectedindexchanged( _ ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles listbox1.selectedindexchanged If listbox1.selectedindex <> -1 Then txtstring.text = CStr(listBox1.SelectedItem) End If End Sub Rev. 2.1 Copyright 2006 Object Innovations 375

78 IntroVb Chapter 10 My Visual Basic 2005 provides a built-in object My that makes it easy to access much information about the application and its runtime environment. Important top-level members of My include Computer, User, and Application. The example program MyDemo provides an illustration, by displaying some information when the form is loaded. Here is the code: Private Sub MainForm_Load(ByVal sender As _ System.Object, ByVal e As System.EventArgs) _ Handles MyBase.Load txtcomputername.text = My.Computer.Name txtusername.text = My.User.Name For Each s As String In _ My.Application.CommandLineArgs lstcmd.items.add(s) Next End Sub Rev. 2.1 Copyright 2006 Object Innovations 376

79 IntroVb Chapter 10 Command Line Arguments In Visual Studio 2005 you can specify command line arguments in the project properties. Right-click over the project in Solution Explorer and select Debug from the list on the left. The command line arguments can be specified as part of the Start Options To save the command line arguments as part of your project information, be sure not to delete the.vbproj.user file. Rev. 2.1 Copyright 2006 Object Innovations 377

80 IntroVb Chapter 10 Lab 10 A GUI for the Dealership In this lab, you will implement a GUI interface for the car dealership implemented in the previous chapters. Detailed instructions are contained in the Lab 10 write-up at the end of the chapter. Suggested time: 60 minutes Rev. 2.1 Copyright 2006 Object Innovations 378

81 IntroVb Chapter 10 Summary With Visual Studio 2005, you can implement a simple graphical user interface with Windows Forms and basic controls. You can use partial classes to organize class code over multiple files. Windows Forms uses the.net event architecture to handle user interface events..net provides various list controls, such as ListBox, for displaying lists of objects. With the built-in object My, you can easily access information about the application and its runtime environment. Rev. 2.1 Copyright 2006 Object Innovations 379

82 IntroVb Chapter 10 Introduction Lab 10 A GUI for the Dealership In this lab, you will implement a GUI interface for the car dealership implemented in the previous chapters. Suggested Time: 60 minutes Root Directory: OIC\IntroVb Directories: Labs\Lab10\Dealership CaseStudy\Dealership\Step4 CaseStudy\Dealership\Step5 (do your work here) (previous version) (answer) Part A. Create the GUI and Show Vehicles 1. Create a new Visual Basic project of type Windows Application DealerGui located in Labs\Lab Change the file name Form1.vb to DealerForm.vb. The form class will now also be DealerForm. 3. Change the Text property of the form to WE-SELL-CARS. 4. Add controls to the form as shown. Note that we show Cost rather than Price, because the Cost text box is used for data entry when we receive a car. Rev. 2.1 Copyright 2006 Object Innovations 380

C++/CLI Essentials. Student Guide Revision 1.0. Object Innovations Course 431

C++/CLI Essentials. Student Guide Revision 1.0. Object Innovations Course 431 C++/CLI Essentials Student Guide Revision 1.0 Object Innovations Course 431 C++/CLI Essentials Rev. 1.0 Student Guide Information in this document is subject to change without notice. Companies, names

More information

Evaluation Copy. C# Essentials. Student Guide Revision 4.5. Object Innovations Course 4102

Evaluation Copy. C# Essentials. Student Guide Revision 4.5. Object Innovations Course 4102 C# Essentials Student Guide Revision 4.5 Object Innovations Course 4102 C# Essentials Rev. 4.5 Student Guide Information in this document is subject to change without notice. Companies, names and data

More information

Evaluation Copy. Visual Basic Essentials. Student Guide Revision 4.5. Object Innovations Course 4202

Evaluation Copy. Visual Basic Essentials. Student Guide Revision 4.5. Object Innovations Course 4202 Visual Basic Essentials Student Guide Revision 4.5 Object Innovations Course 4202 Visual Basic Essentials Rev. 4.5 Student Guide Information in this document is subject to change without notice. Companies,

More information

Object-Oriented Programming in C# (VS 2012)

Object-Oriented Programming in C# (VS 2012) Object-Oriented Programming in C# (VS 2012) This thorough and comprehensive course is a practical introduction to programming in C#, utilizing the services provided by.net. This course emphasizes the C#

More information

Object-Oriented Programming in C# (VS 2015)

Object-Oriented Programming in C# (VS 2015) Object-Oriented Programming in C# (VS 2015) This thorough and comprehensive 5-day course is a practical introduction to programming in C#, utilizing the services provided by.net. This course emphasizes

More information

Object-Oriented Programming in Visual Basic

Object-Oriented Programming in Visual Basic Object-Oriented Programming in Visual Basic Student Guide Revision 4.0 Object Innovations Course 4201 Object-Oriented Programming in Visual Basic Rev. 4.0 Student Guide Information in this document is

More information

C# Programming: From Problem Analysis to Program Design. Fourth Edition

C# Programming: From Problem Analysis to Program Design. Fourth Edition C# Programming: From Problem Analysis to Program Design Fourth Edition Preface xxi INTRODUCTION TO COMPUTING AND PROGRAMMING 1 History of Computers 2 System and Application Software 4 System Software 4

More information

IT 374 C# and Applications/ IT695 C# Data Structures

IT 374 C# and Applications/ IT695 C# Data Structures IT 374 C# and Applications/ IT695 C# Data Structures Module 2.1: Introduction to C# App Programming Xianrong (Shawn) Zheng Spring 2017 1 Outline Introduction Creating a Simple App String Interpolation

More information

EVALUATION COPY. Object-Oriented Programming in C# Student Guide Revision 4.6. Unauthorized reproduction or distribution is prohibited.

EVALUATION COPY. Object-Oriented Programming in C# Student Guide Revision 4.6. Unauthorized reproduction or distribution is prohibited. Object-Oriented Programming in C# Student Guide Revision 4.6 Object Innovations Course 4101 Object-Oriented Programming in C# Rev. 4.6 Student Guide Information in this document is subject to change without

More information

Object-Oriented Programming in C# Evaluation Copy. Student Guide Revision 4.5. Object Innovations Course 4101

Object-Oriented Programming in C# Evaluation Copy. Student Guide Revision 4.5. Object Innovations Course 4101 Object-Oriented Programming in C# Student Guide Revision 4.5 Object Innovations Course 4101 Object-Oriented Programming in C# Rev. 4.5 Student Guide Information in this document is subject to change without

More information

Prerequisites: The student should have programming experience in a high-level language. ITCourseware, LLC Page 1. Object-Oriented Programming in C#

Prerequisites: The student should have programming experience in a high-level language. ITCourseware, LLC Page 1. Object-Oriented Programming in C# Microsoft s.net is a revolutionary advance in programming technology that greatly simplifies application development and is a good match for the emerging paradigm of Web-based services, as opposed to proprietary

More information

Student Guide Revision 1.0

Student Guide Revision 1.0 Robert J. Oberg Student Guide Revision 1.0 Object Innovations Course 411 C# Essentials Rev. 1.0 Student Guide Information in this document is subject to change without notice. Companies, names and data

More information

Course Syllabus C # Course Title. Who should attend? Course Description

Course Syllabus C # Course Title. Who should attend? Course Description Course Title C # Course Description C # is an elegant and type-safe object-oriented language that enables developers to build a variety of secure and robust applications that run on the.net Framework.

More information

Chapters are PDF documents posted online at the book s Companion Website (located at

Chapters are PDF documents posted online at the book s Companion Website (located at vbhtp6printonlytoc.fm Page ix Wednesday, February 27, 2013 11:59 AM Chapters 16 31 are PDF documents posted online at the book s Companion Website (located at www.pearsonhighered.com/deitel/). Preface

More information

Introduction to Microsoft.NET Framework Programming using VS 2005 (C#)

Introduction to Microsoft.NET Framework Programming using VS 2005 (C#) Introduction to Microsoft.NET Framework Programming using VS 2005 (C#) Course Length: 5 Days Course Overview This instructor-led course teaches introductory-level developers who are not familiar with the

More information

UNIT 1. Introduction to Microsoft.NET framework and Basics of VB.Net

UNIT 1. Introduction to Microsoft.NET framework and Basics of VB.Net UNIT 1 Introduction to Microsoft.NET framework and Basics of VB.Net 1 SYLLABUS 1.1 Overview of Microsoft.NET Framework 1.2 The.NET Framework components 1.3 The Common Language Runtime (CLR) Environment

More information

C# Programming in the.net Framework

C# Programming in the.net Framework 50150B - Version: 2.1 04 May 2018 C# Programming in the.net Framework C# Programming in the.net Framework 50150B - Version: 2.1 6 days Course Description: This six-day instructor-led course provides students

More information

Chapters and Appendix F are PDF documents posted online at the book s Companion Website (located at

Chapters and Appendix F are PDF documents posted online at the book s Companion Website (located at Contents Chapters 16 27 and Appendix F are PDF documents posted online at the book s Companion Website (located at www.pearsonhighered.com/deitel/). Preface Before You Begin xix xxix 1 Introduction to

More information

DEPARTMENT OF INFORMATION TECHNOLOGY Academic Year 2015-2016 QUESTION BANK-EVEN SEMESTER NAME OF THE SUBJECT SUBJECT CODE SEMESTER YEAR DEPARTMENT C# and.net Programming CS6001 VI III IT UNIT 1 PART A

More information

Introduction to C# Applications

Introduction to C# Applications 1 2 3 Introduction to C# Applications OBJECTIVES To write simple C# applications To write statements that input and output data to the screen. To declare and use data of various types. To write decision-making

More information

ADO.NET 2.0. database programming with

ADO.NET 2.0. database programming with TRAINING & REFERENCE murach s ADO.NET 2.0 database programming with (Chapter 3) VB 2005 Thanks for downloading this chapter from Murach s ADO.NET 2.0 Database Programming with VB 2005. We hope it will

More information

Dot Net Online Training

Dot Net Online Training chakraitsolutions.com http://chakraitsolutions.com/dotnet-online-training/ Dot Net Online Training DOT NET Online Training CHAKRA IT SOLUTIONS TO LEARN ABOUT OUR UNIQUE TRAINING PROCESS: Title : Dot Net

More information

Fundamental C# Programming

Fundamental C# Programming Part 1 Fundamental C# Programming In this section you will find: Chapter 1: Introduction to C# Chapter 2: Basic C# Programming Chapter 3: Expressions and Operators Chapter 4: Decisions, Loops, and Preprocessor

More information

2. A GUI A. uses buttons, menus, and icons B. should be easy for a user to manipulate C. both (a) and (b) D. stands for Graphic Use Interaction

2. A GUI A. uses buttons, menus, and icons B. should be easy for a user to manipulate C. both (a) and (b) D. stands for Graphic Use Interaction 1. Which language is not a true object-oriented programming language? A. VB 6 B. VB.NET C. JAVA D. C++ 2. A GUI A. uses buttons, menus, and icons B. should be easy for a user to manipulate C. both (a)

More information

Introduction to Programming Microsoft.NET Framework Applications with Microsoft Visual Studio 2005 (C#)

Introduction to Programming Microsoft.NET Framework Applications with Microsoft Visual Studio 2005 (C#) Introduction to Programming Microsoft.NET Framework Applications with Microsoft Visual Studio 2005 (C#) Course Number: 4994A Length: 3 Day(s) Certification Exam There are no exams associated with this

More information

Chapter 1 Getting Started

Chapter 1 Getting Started Chapter 1 Getting Started The C# class Just like all object oriented programming languages, C# supports the concept of a class. A class is a little like a data structure in that it aggregates different

More information

Getting started 7. Setting properties 23

Getting started 7. Setting properties 23 Contents 1 2 3 Getting started 7 Introducing Visual Basic 8 Installing Visual Studio 10 Exploring the IDE 12 Starting a new project 14 Adding a visual control 16 Adding functional code 18 Saving projects

More information

M. K. Institute Of Computer Studies, Bharuch SYBCA SEM IV VB.NET (Question Bank)

M. K. Institute Of Computer Studies, Bharuch SYBCA SEM IV VB.NET (Question Bank) Unit-1 (overview of Microsoft.net framework) 1. What is CLR? What is its use? (2 times) 2 2. What is garbage collection? 2 3. Explain MSIL 2 4. Explain CTS in detail 2 5. List the extension of files available

More information

1 Information system An information system is the combination of technology(computers) and people that enable an organization to collect data, store them, and transform them into information Data Data

More information

C# Syllabus. MS.NET Framework Introduction

C# Syllabus. MS.NET Framework Introduction C# Syllabus MS.NET Framework Introduction The.NET Framework - an Overview Framework Components Framework Versions Types of Applications which can be developed using MS.NET MS.NET Base Class Library MS.NET

More information

First Visual Basic Lab Paycheck-V1.0

First Visual Basic Lab Paycheck-V1.0 VISUAL BASIC LAB ASSIGNMENT #1 First Visual Basic Lab Paycheck-V1.0 Copyright 2013 Dan McElroy Paycheck-V1.0 The purpose of this lab assignment is to enter a Visual Basic project into Visual Studio and

More information

How to use data sources with databases (part 1)

How to use data sources with databases (part 1) Chapter 14 How to use data sources with databases (part 1) 423 14 How to use data sources with databases (part 1) Visual Studio 2005 makes it easier than ever to generate Windows forms that work with data

More information

PESIT- Bangalore South Campus Hosur Road (1km Before Electronic city) Bangalore

PESIT- Bangalore South Campus Hosur Road (1km Before Electronic city) Bangalore PESIT- Bangalore South Campus Hosur Road (1km Before Electronic city) Bangalore 560 100 Department of MCA COURSE INFORMATION SHEET Programming Using C#.NET (13MCA53) 1. GENERAL INFORMATION: Academic Year:

More information

UNIT 1 PART A PART B

UNIT 1 PART A PART B UNIT 1 PART A 1. List some of the new features that are unique to c# language? 2. State few words about the two important entities of.net frame work 3. What is.net? Name any 4 applications that are supported

More information

M Introduction to C# Programming with Microsoft.NET - 5 Day Course

M Introduction to C# Programming with Microsoft.NET - 5 Day Course Module 1: Getting Started This module presents the concepts that are central to the Microsoft.NET Framework and platform, and the Microsoft Visual Studio.NET integrated development environment (IDE); describes

More information

A Complete Tutorial for Beginners LIEW VOON KIONG

A Complete Tutorial for Beginners LIEW VOON KIONG I A Complete Tutorial for Beginners LIEW VOON KIONG Disclaimer II Visual Basic 2008 Made Easy- A complete tutorial for beginners is an independent publication and is not affiliated with, nor has it been

More information

Visual Basic 2008 Anne Boehm

Visual Basic 2008 Anne Boehm TRAINING & REFERENCE murach s Visual Basic 2008 Anne Boehm (Chapter 3) Thanks for downloading this chapter from Murach s Visual Basic 2008. We hope it will show you how easy it is to learn from any Murach

More information

DOT NET Syllabus (6 Months)

DOT NET Syllabus (6 Months) DOT NET Syllabus (6 Months) THE COMMON LANGUAGE RUNTIME (C.L.R.) CLR Architecture and Services The.Net Intermediate Language (IL) Just- In- Time Compilation and CLS Disassembling.Net Application to IL

More information

Department of Computer Applications

Department of Computer Applications MCA 512:.NET framework and C# [Part I : Medium Answer type Questions] Unit - 1 Q1. What different tools are available and used to develop.net Applications? Hint a).net Framework SDK b) ASP.NET Web Matrix

More information

You will have mastered the material in this chapter when you can:

You will have mastered the material in this chapter when you can: CHAPTER 6 Loop Structures OBJECTIVES You will have mastered the material in this chapter when you can: Add a MenuStrip object Use the InputBox function Display data using the ListBox object Understand

More information

DOT NET SYLLABUS FOR 6 MONTHS

DOT NET SYLLABUS FOR 6 MONTHS DOT NET SYLLABUS FOR 6 MONTHS INTRODUCTION TO.NET Domain of.net D.N.A. Architecture One Tier Two Tier Three Tier N-Tier THE COMMON LANGUAGE RUNTIME (C.L.R.) CLR Architecture and Services The.Net Intermediate

More information

Uka Tarsadia University MCA ( 3rd Semester)/M.Sc.(CA) (1st Semester) Course : / Visual Programming Question Bank

Uka Tarsadia University MCA ( 3rd Semester)/M.Sc.(CA) (1st Semester) Course : / Visual Programming Question Bank Unit 1 Introduction to.net Platform Q: 1 Answer in short. 1. Which three main components are available in.net framework? 2. List any two new features added in.net framework 4.0 which is not available in

More information

Visual Studio.NET. Although it is possible to program.net using only the command OVERVIEW OF VISUAL STUDIO.NET

Visual Studio.NET. Although it is possible to program.net using only the command OVERVIEW OF VISUAL STUDIO.NET Chapter. 03 9/17/01 6:08 PM Page 35 Visual Studio.NET T H R E E Although it is possible to program.net using only the command line compiler, it is much easier and more enjoyable to use Visual Studio.NET.

More information

Getting started 7. Setting properties 23

Getting started 7. Setting properties 23 Contents 1 2 3 Getting started 7 Introduction 8 Installing Visual Basic 10 Exploring the IDE 12 Starting a new project 14 Adding a visual control 16 Adding functional code 18 Saving projects 20 Reopening

More information

This page intentionally left blank

This page intentionally left blank This page intentionally left blank Starting Out With Visual Basic: International Edition Table of Contents Cover Contents Preface Chapter 1 Introduction to Programming and Visual Basic 1.1 Computer Systems:

More information

EVALUATION COPY. Unauthorized reproduction or distribution is prohibitied C# ESSENTIALS

EVALUATION COPY. Unauthorized reproduction or distribution is prohibitied C# ESSENTIALS C# ESSENTIALS C# Essentials Rev. 4.8 Student Guide Information in this document is subject to change without notice. Companies, names and data used in examples herein are fictitious unless otherwise noted.

More information

Fig 1.1.NET Framework Architecture Block Diagram

Fig 1.1.NET Framework Architecture Block Diagram Overview of Microsoft.NET Framework The.NET Framework is a technology that supports building and running the next generation of applications and XML Web services. Using.Net technology it is easy to use

More information

CHAPTER 1: INTRODUCTION TO THE IDE 3

CHAPTER 1: INTRODUCTION TO THE IDE 3 INTRODUCTION xxvii PART I: IDE CHAPTER 1: INTRODUCTION TO THE IDE 3 Introducing the IDE 3 Different IDE Appearances 4 IDE Configurations 5 Projects and Solutions 6 Starting the IDE 6 Creating a Project

More information

ASP.NET Web Forms Programming Using Visual Basic.NET

ASP.NET Web Forms Programming Using Visual Basic.NET ASP.NET Web Forms Programming Using Visual Basic.NET Duration: 35 hours Price: $750 Delivery Option: Attend training via an on-demand, self-paced platform paired with personal instructor facilitation.

More information

Microsoft Visual Basic 2005 CHAPTER 6. Loop Structures

Microsoft Visual Basic 2005 CHAPTER 6. Loop Structures Microsoft Visual Basic 2005 CHAPTER 6 Loop Structures Objectives Add a MenuStrip object Use the InputBox function Display data using the ListBox object Understand the use of counters and accumulators Understand

More information

This page intentionally left blank

This page intentionally left blank This page intentionally left blank arting Out with Java: From Control Structures through Objects International Edition - PDF - PDF - PDF Cover Contents Preface Chapter 1 Introduction to Computers and Java

More information

HOUR 4 Understanding Events

HOUR 4 Understanding Events HOUR 4 Understanding Events It s fairly easy to produce an attractive interface for an application using Visual Basic.NET s integrated design tools. You can create beautiful forms that have buttons to

More information

Objectives. Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments

Objectives. Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments Basics Objectives Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments 2 Class Keyword class used to define new type specify

More information

Hands-On Lab. Lab Manual HOL007 Understanding, Designing, and Refactoring Code Using the New Class Designer Tool in Microsoft Visual Studio 2005

Hands-On Lab. Lab Manual HOL007 Understanding, Designing, and Refactoring Code Using the New Class Designer Tool in Microsoft Visual Studio 2005 Hands-On Lab Lab Manual HOL007 Understanding, Designing, and Refactoring Code Using the New Class Designer Tool in Microsoft Visual Studio 2005 Please do not remove this manual from the lab Page 1 Information

More information

COPYRIGHTED MATERIAL. Contents. Part I: C# Fundamentals 1. Chapter 1: The.NET Framework 3. Chapter 2: Getting Started with Visual Studio

COPYRIGHTED MATERIAL. Contents. Part I: C# Fundamentals 1. Chapter 1: The.NET Framework 3. Chapter 2: Getting Started with Visual Studio Introduction XXV Part I: C# Fundamentals 1 Chapter 1: The.NET Framework 3 What s the.net Framework? 3 Common Language Runtime 3.NET Framework Class Library 4 Assemblies and the Microsoft Intermediate Language

More information

2609 : Introduction to C# Programming with Microsoft.NET

2609 : Introduction to C# Programming with Microsoft.NET 2609 : Introduction to C# Programming with Microsoft.NET Introduction In this five-day instructor-led course, developers learn the fundamental skills that are required to design and develop object-oriented

More information

Chapter 12. OOP: Creating Object- Oriented Programs. McGraw-Hill. Copyright 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved.

Chapter 12. OOP: Creating Object- Oriented Programs. McGraw-Hill. Copyright 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. Chapter 12 OOP: Creating Object- Oriented Programs McGraw-Hill Copyright 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. Objectives (1 of 2) Use object-oriented terminology correctly. Create

More information

Creating Reports in Access 2007 Table of Contents GUIDE TO DESIGNING REPORTS... 3 DECIDE HOW TO LAY OUT YOUR REPORT... 3 MAKE A SKETCH OF YOUR

Creating Reports in Access 2007 Table of Contents GUIDE TO DESIGNING REPORTS... 3 DECIDE HOW TO LAY OUT YOUR REPORT... 3 MAKE A SKETCH OF YOUR Creating Reports in Access 2007 Table of Contents GUIDE TO DESIGNING REPORTS... 3 DECIDE HOW TO LAY OUT YOUR REPORT... 3 MAKE A SKETCH OF YOUR REPORT... 3 DECIDE WHICH DATA TO PUT IN EACH REPORT SECTION...

More information

Microsoft. Microsoft Visual C# Step by Step. John Sharp

Microsoft. Microsoft Visual C# Step by Step. John Sharp Microsoft Microsoft Visual C#- 2010 Step by Step John Sharp Table of Contents Acknowledgments Introduction xvii xix Part I Introducing Microsoft Visual C# and Microsoft Visual Studio 2010 1 Welcome to

More information

Contents. Using Interpreters... 5 Using Compilers... 5 Program Development Life Cycle... 6

Contents. Using Interpreters... 5 Using Compilers... 5 Program Development Life Cycle... 6 Contents ***Introduction*** Introduction to Programming... 1 Introduction... 2 What is a Program?... 2 Role Played by a Program to Perform a Task... 2 What is a Programming Language?... 3 Types of Programming

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

To get started with Visual Basic 2005, I recommend that you jump right in

To get started with Visual Basic 2005, I recommend that you jump right in In This Chapter Chapter 1 Wading into Visual Basic Seeing where VB fits in with.net Writing your first Visual Basic 2005 program Exploiting the newfound power of VB To get started with Visual Basic 2005,

More information

Learning to Program in Visual Basic 2005 Table of Contents

Learning to Program in Visual Basic 2005 Table of Contents Table of Contents INTRODUCTION...INTRO-1 Prerequisites...INTRO-2 Installing the Practice Files...INTRO-3 Software Requirements...INTRO-3 Installation...INTRO-3 Demonstration Applications...INTRO-3 About

More information

Course Outline. Introduction to java

Course Outline. Introduction to java Course Outline 1. Introduction to OO programming 2. Language Basics Syntax and Semantics 3. Algorithms, stepwise refinements. 4. Quiz/Assignment ( 5. Repetitions (for loops) 6. Writing simple classes 7.

More information

INTRODUCTION TO.NET. Domain of.net D.N.A. Architecture One Tier Two Tier Three Tier N-Tier THE COMMON LANGUAGE RUNTIME (C.L.R.)

INTRODUCTION TO.NET. Domain of.net D.N.A. Architecture One Tier Two Tier Three Tier N-Tier THE COMMON LANGUAGE RUNTIME (C.L.R.) INTRODUCTION TO.NET Domain of.net D.N.A. Architecture One Tier Two Tier Three Tier N-Tier THE COMMON LANGUAGE RUNTIME (C.L.R.) CLR Architecture and Services The.Net Intermediate Language (IL) Just- In-

More information

EEE-425 Programming Languages (2013) 1

EEE-425 Programming Languages (2013) 1 2 Computer programming: creating a sequence of instructions to enable the computer to do something Programmers do not use machine language when creating computer programs. Instead, programmers tend to

More information

Deitel Series Page How To Program Series

Deitel Series Page How To Program Series Deitel Series Page How To Program Series Android How to Program C How to Program, 7/E C++ How to Program, 9/E C++ How to Program, Late Objects Version, 7/E Java How to Program, 9/E Java How to Program,

More information

Introduce C# as Object Oriented programming language. Explain, tokens,

Introduce C# as Object Oriented programming language. Explain, tokens, Module 2 98 Assignment 1 Introduce C# as Object Oriented programming language. Explain, tokens, lexicals and control flow constructs. 99 The C# Family Tree C Platform Independence C++ Object Orientation

More information

Advanced Object-Oriented Programming. 11 Features. C# Programming: From Problem Analysis to Program Design. 4th Edition

Advanced Object-Oriented Programming. 11 Features. C# Programming: From Problem Analysis to Program Design. 4th Edition 11 Features Advanced Object-Oriented Programming C# Programming: From Problem Analysis to Program Design C# Programming: From Problem Analysis to Program Design 1 4th Edition Chapter Objectives Learn the

More information

VB.NET. Exercise 1: Creating Your First Application in Visual Basic.NET

VB.NET. Exercise 1: Creating Your First Application in Visual Basic.NET VB.NET Module 1: Getting Started This module introduces Visual Basic.NET and explains how it fits into the.net platform. It explains how to use the programming tools in Microsoft Visual Studio.NET and

More information

Darshan Institute of Engineering & Technology for Diploma Studies

Darshan Institute of Engineering & Technology for Diploma Studies Overview of Microsoft.Net Framework: The Dot Net or.net is a technology that is an outcome of Microsoft s new strategy to develop window based robust applications and rich web applications and to keep

More information

Course Hours

Course Hours Programming the.net Framework 4.0/4.5 with C# 5.0 Course 70240 40 Hours Microsoft's.NET Framework presents developers with unprecedented opportunities. From 'geoscalable' web applications to desktop and

More information

SQL Server. Management Studio. Chapter 3. In This Chapter. Management Studio. c Introduction to SQL Server

SQL Server. Management Studio. Chapter 3. In This Chapter. Management Studio. c Introduction to SQL Server Chapter 3 SQL Server Management Studio In This Chapter c Introduction to SQL Server Management Studio c Using SQL Server Management Studio with the Database Engine c Authoring Activities Using SQL Server

More information

M. K. Institute Of Computer Studies, Bharuch SYBCA SEM IV VB.NET (Question Bank)

M. K. Institute Of Computer Studies, Bharuch SYBCA SEM IV VB.NET (Question Bank) Unit-1 (overview of Microsoft.net framework) 1. What is CLR? What is its use? (2 times) 2 2. What is garbage collection? 2 3. Explain MSIL (mar/apr-201) 2 times 2 4. Explain CTS in detail 2 5. List the

More information

Learning C# 3.0. Jesse Liberty and Brian MacDonald O'REILLY. Beijing Cambridge Farnham Köln Sebastopol Taipei Tokyo

Learning C# 3.0. Jesse Liberty and Brian MacDonald O'REILLY. Beijing Cambridge Farnham Köln Sebastopol Taipei Tokyo Learning C# 3.0 Jesse Liberty and Brian MacDonald O'REILLY Beijing Cambridge Farnham Köln Sebastopol Taipei Tokyo Table of Contents Preface xv 1. C# and.net Programming 1 Installing C# Express 2 C# 3.0

More information

"Charting the Course... MOC Programming in C# with Microsoft Visual Studio Course Summary

Charting the Course... MOC Programming in C# with Microsoft Visual Studio Course Summary Course Summary NOTE - The course delivery has been updated to Visual Studio 2013 and.net Framework 4.5! Description The course focuses on C# program structure, language syntax, and implementation details

More information

Scenario Manager User Guide. Release September 2013

Scenario Manager User Guide. Release September 2013 Scenario Manager User Guide Release 6.2.1 September 2013 Scenario Manager User Guide Release 6.2.1 September 2013 Document Control Number: 9MN12-62110017 Document Number: SMUG-13-FCCM-0017-6.2.1-01 Oracle

More information

Programming in Visual Basic with Microsoft Visual Studio 2010

Programming in Visual Basic with Microsoft Visual Studio 2010 Programming in Visual Basic with Microsoft Visual Studio 2010 Course 10550; 5 Days, Instructor-led Course Description This course teaches you Visual Basic language syntax, program structure, and implementation

More information

Outsource. Laboratories. Introduction to Programming with Microsoft Visual Basic.NET. Outsource Laboratories Press

Outsource. Laboratories. Introduction to Programming with Microsoft Visual Basic.NET. Outsource Laboratories Press Outsource Laboratories Introduction to Programming with Microsoft Visual Basic.NET Outsource Laboratories Press Copyright 2004 Outsource Laboratories Press. Printed in the United States of America ISBN

More information

B.V Patel Institute of BMC & IT, UTU

B.V Patel Institute of BMC & IT, UTU Corse Code and Corse Name: 030010401-GUI Programming Unit 1. Introduction to.net Framework Short Questions 1. What is.net Framework? 2. What is VB.NET? 3. Which are the main components of.net Framework?

More information

Creating a Class Library You should have your favorite version of Visual Studio open. Richard Kidwell. CSE 4253 Programming in C# Worksheet #2

Creating a Class Library You should have your favorite version of Visual Studio open. Richard Kidwell. CSE 4253 Programming in C# Worksheet #2 Worksheet #2 Overview For this worksheet, we will create a class library and then use the resulting dynamic link library (DLL) in a console application. This worksheet is a start on your next programming

More information

MyProgram m i ng Lab. get with the programming. Through the power of practice and immediate personalized

MyProgram m i ng Lab. get with the programming. Through the power of practice and immediate personalized get with the programming Through the power of practice and immediate personalized feedback, MyProgrammingLab improves your performance. MyProgram m i ng Lab Learn more at www.myprogramminglab.com Preface

More information

PROGRAMMING IN VISUAL BASIC WITH MICROSOFT VISUAL STUDIO Course: 10550A; Duration: 5 Days; Instructor-led

PROGRAMMING IN VISUAL BASIC WITH MICROSOFT VISUAL STUDIO Course: 10550A; Duration: 5 Days; Instructor-led CENTER OF KNOWLEDGE, PATH TO SUCCESS Website: PROGRAMMING IN VISUAL BASIC WITH MICROSOFT VISUAL STUDIO 2010 Course: 10550A; Duration: 5 Days; Instructor-led WHAT YOU WILL LEARN This course teaches you

More information

M Introduction to Visual Basic.NET Programming with Microsoft.NET 5 Day Course

M Introduction to Visual Basic.NET Programming with Microsoft.NET 5 Day Course Module 1: Getting Started This module introduces Visual Basic.NET and explains how it fits into the.net platform. It explains how to use the programming tools in Microsoft Visual Studio.NET and provides

More information

2559 : Introduction to Visual Basic.NET Programming with Microsoft.NET

2559 : Introduction to Visual Basic.NET Programming with Microsoft.NET 2559 : Introduction to Visual Basic.NET Programming with Microsoft.NET Introduction Elements of this syllabus are subject to change. This five-day instructor-led course provides students with the knowledge

More information

Unit 4. Lesson 4.1. Managing Data. Data types. Introduction. Data type. Visual Basic 2008 Data types

Unit 4. Lesson 4.1. Managing Data. Data types. Introduction. Data type. Visual Basic 2008 Data types Managing Data Unit 4 Managing Data Introduction Lesson 4.1 Data types We come across many types of information and data in our daily life. For example, we need to handle data such as name, address, money,

More information

Introduction to Programming Microsoft.NET Applications with Visual Studio 2008 (C#)

Introduction to Programming Microsoft.NET Applications with Visual Studio 2008 (C#) Introduction to Programming Microsoft.NET Applications with Visual Studio 2008 (C#) Course Number: 6367A Course Length: 3 Days Course Overview This three-day course will enable students to start designing

More information

VALLIAMMAI ENGINEERING COLLEGE

VALLIAMMAI ENGINEERING COLLEGE VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur 603 203 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK B.E. - Electrical and Electronics Engineering IV SEMESTER CS6456 - OBJECT ORIENTED

More information

VB.NET Web : Phone : INTRODUCTION TO NET FRAME WORK

VB.NET Web : Phone : INTRODUCTION TO NET FRAME WORK Web :- Email :- info@aceit.in Phone :- +91 801 803 3055 VB.NET INTRODUCTION TO NET FRAME WORK Basic package for net frame work Structure and basic implementation Advantages Compare with other object oriented

More information

Visual Basic 2008 The programming part

Visual Basic 2008 The programming part Visual Basic 2008 The programming part Code Computer applications are built by giving instructions to the computer. In programming, the instructions are called statements, and all of the statements that

More information

Business Insight Authoring

Business Insight Authoring Business Insight Authoring Getting Started Guide ImageNow Version: 6.7.x Written by: Product Documentation, R&D Date: August 2016 2014 Perceptive Software. All rights reserved CaptureNow, ImageNow, Interact,

More information

Objective of the Course: (Why the course?) Brief Course outline: (Main headings only) C# Question Bank Chapter1: Philosophy of.net

Objective of the Course: (Why the course?) Brief Course outline: (Main headings only) C# Question Bank Chapter1: Philosophy of.net Objective of the Course: (Why the course?) To provide a brief introduction to the.net platform and C# programming language constructs. Enlighten the students about object oriented programming, Exception

More information

Control Flow. COMS W1007 Introduction to Computer Science. Christopher Conway 3 June 2003

Control Flow. COMS W1007 Introduction to Computer Science. Christopher Conway 3 June 2003 Control Flow COMS W1007 Introduction to Computer Science Christopher Conway 3 June 2003 Overflow from Last Time: Why Types? Assembly code is typeless. You can take any 32 bits in memory, say this is an

More information

Getting started 7. Storing values 21. Creating variables 22 Reading input 24 Employing arrays 26 Casting data types 28 Fixing constants 30 Summary 32

Getting started 7. Storing values 21. Creating variables 22 Reading input 24 Employing arrays 26 Casting data types 28 Fixing constants 30 Summary 32 Contents 1 2 3 Contents Getting started 7 Introducing C# 8 Installing Visual Studio 10 Exploring the IDE 12 Starting a Console project 14 Writing your first program 16 Following the rules 18 Summary 20

More information

Creating and Running Your First C# Program

Creating and Running Your First C# Program Creating and Running Your First C# Program : http://eembdersler.wordpress.com Choose the EEE-425Programming Languages (Fall) Textbook reading schedule Pdf lecture notes Updated class syllabus Midterm and

More information

EEE-425 Programming Languages (2013) 1

EEE-425 Programming Languages (2013) 1 Creating and Running Your First C# Program : http://eembdersler.wordpress.com Choose the EEE-425Programming Languages (Fall) Textbook reading schedule Pdf lecture notes Updated class syllabus Midterm and

More information

Book IX. Developing Applications Rapidly

Book IX. Developing Applications Rapidly Book IX Developing Applications Rapidly Contents at a Glance Chapter 1: Building Master and Detail Pages Chapter 2: Creating Search and Results Pages Chapter 3: Building Record Insert Pages Chapter 4:

More information

Microsoft Visual C# 2005: Developing Applications Table of Contents

Microsoft Visual C# 2005: Developing Applications Table of Contents Table of Contents INTRODUCTION...INTRO-1 Prerequisites...INTRO-2 Installing the Practice Files...INTRO-3 Software Requirements...INTRO-3 Sample Database...INTRO-3 Security...INTRO-4 Installation...INTRO-4

More information

Simple sets of data can be expressed in a simple table, much like a

Simple sets of data can be expressed in a simple table, much like a Chapter 1: Building Master and Detail Pages In This Chapter Developing master and detail pages at the same time Building your master and detail pages separately Putting together master and detail pages

More information

I101/B100 Problem Solving with Computers

I101/B100 Problem Solving with Computers I101/B100 Problem Solving with Computers By: Dr. Hossein Hakimzadeh Computer Science and Informatics IU South Bend 1 What is Visual Basic.Net Visual Basic.Net is the latest reincarnation of Basic language.

More information