1 / 57

Objectives

1. Objectives. Major concepts. Explain the history of programming languages Define the terminology used in object-oriented programming languages Create a Visual Basic .NET Windows-based application Manage the windows in the IDE Set the properties of an object.

Download Presentation

Objectives

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 1

  2. Objectives Major concepts • Explain the history of programming languages • Define the terminology used in object-oriented programming languages • Create a Visual Basic .NET Windows-based application • Manage the windows in the IDE • Set the properties of an object Integrated Development Environment Microsoft Visual Basic .NET: Reloaded

  3. Objectives (continued) • Add a control to a form • Use the Label and Button tools • Enter code in the Code Editor window • Save a solution • Start and end an application Ex: button Microsoft Visual Basic .NET: Reloaded

  4. Objectives (continued) • Print a project’s code • Close a solution • Open an existing solution Without computer generated code! Microsoft Visual Basic .NET: Reloaded

  5. Programmers • Programmers • People who write programs • Programs • Directions given to a computer accomplish a given task Underlying logic is an algorithm – sequence of steps to solve a problem Microsoft Visual Basic .NET: Reloaded

  6. A Brief History of Programming Languages • Machine Languages • 0 (for on switch) • 1 (for off switch) • Tedious and prone to error • Assembly Languages • More advanced than machine languages • Mnemonics (memory aids) • Examples: MUL b1, ax • Require an assembler There are lots of programming languages – starting with low level moving to high level Microsoft Visual Basic .NET: Reloaded

  7. A Brief History of Programming Languages (continued) • High Level Languages • Require Interpreter or compiler • Interpreter translates high-level into machine code line-by-line while program is running • Compiler translates entire program before program has run • English like syntax • Allow for object-oriented programming • Programmer focuses on using objects to achieve the program’s goal High level languages: C, C++, Java, VB .NET Compiler produces executable code (.exe) Older way – procedural – new way objects Microsoft Visual Basic .NET: Reloaded

  8. OOP Terminology Objects are things that can be manipulated – in English - nouns. • Object • Anything that can be seen touched, or used • Has Attributes - also called Properties • Characteristics that describe the object • Has Behaviors - also called Methods • Operations the object is capable of performing • Class • Pattern or blueprint used to create an object A class defines what an object will look like. Microsoft Visual Basic .NET: Reloaded

  9. OOP Terminology (continued) • Encapsulation • Combination of attributes and behaviors that describe object created by class • Abstraction • Hiding internal details of object from user • Inheritance • Ability to create one class from another • Polymorphism • Same instruction carried out differently depending on the object giving the instruction Things that are abstracted have details hidden from the user New class has characteristics of parent + new characteristics Microsoft Visual Basic .NET: Reloaded

  10. Illustration of OOP Terms Microsoft Visual Basic .NET: Reloaded

  11. Visual Studio .NET There are other IDE’s other than those by Microsoft! • IDE • Integrated Development Environment • Contains all the features needed to create, run, and test programs • Editor for entering program instructions • Compiler for running and testing program • Allows creation of Web-based and Windows-based applications Microsoft Visual Basic .NET: Reloaded

  12. Visual Studio .NET (continued) • Solution .sln • Container for project and files for application • Project .vbproj • Container for storing files associated with a specific piece of the application • Files • Individual files necessary to store information about the application • Include forms and class information Can click on this to start the IDE. Microsoft Visual Basic .NET: Reloaded

  13. Illustration of solution, project, and file Microsoft Visual Basic .NET: Reloaded

  14. Starting Microsoft Visual Studio .NET Microsoft Visual Basic .NET: Reloaded

  15. Visual Studio .NET 2003 startup screen Microsoft Visual Basic .NET: Reloaded

  16. Purpose of windows in the IDE Microsoft Visual Basic .NET: Reloaded

  17. HOW TO… Microsoft Visual Basic .NET: Reloaded

  18. Creating A Visual Basic .Net Windows-Based Application Microsoft Visual Basic .NET: Reloaded

  19. Creating A Visual Basic .Net Windows-Based Application (continued) Microsoft Visual Basic .NET: Reloaded

  20. HOW TO… Microsoft Visual Basic .NET: Reloaded

  21. The Dynamic Help Window Microsoft Visual Basic .NET: Reloaded

  22. The Windows Form Designer Window • Windows form object (form) • Foundation for the user interface Microsoft Visual Basic .NET: Reloaded

  23. Solution Explorer Window • Contains: • Projects • References • Addresses of memory cells • Namespace – block of internal memory cells • Contains code that defines a group of related classes • Source files • Contains program instructions – called code • Examples: Assembly information, Forms VB code. Microsoft Visual Basic .NET: Reloaded

  24. The Solution Explorer Window (continued) Click on Form1.vb to have form displayed in the IDE. Microsoft Visual Basic .NET: Reloaded

  25. The Properties Window • Object box (contains name of selected object) • Properties list has 2 columns • Left column displays property names • Right column displays Settings box • Contains current value for each property Microsoft Visual Basic .NET: Reloaded

  26. Properties of a Windows Form Object • Select object to display properties • Dot member access operator • Separates words in property name • Example: System.Windows.Form.Form DOTS important! Microsoft Visual Basic .NET: Reloaded

  27. Properties of a Windows Form Object (continued) Microsoft Visual Basic .NET: Reloaded

  28. The Toolbox Window • Toolbox contains tools and other components used in creating application • Tools are called controls • Controls are displayed on the form Use the thumbtack to tack toolbox to side of IDE Microsoft Visual Basic .NET: Reloaded

  29. HOW TO… Microsoft Visual Basic .NET: Reloaded

  30. The Label Tool • Use tool to instantiate a Label object • Object displays text that user is not allowed to edit This shows some example of where to use a label. Microsoft Visual Basic .NET: Reloaded

  31. HOW TO… Microsoft Visual Basic .NET: Reloaded

  32. The Button Tool • Button Tool instantiates a Button control • Button Control used to perform immediate action when clicked Here are 2 buttons [Calc] and [Exit] Microsoft Visual Basic .NET: Reloaded

  33. HOW TO… Microsoft Visual Basic .NET: Reloaded

  34. The Code Editor Window The user does these. • Events • Actions such as clicking, double-clicking, and scrolling • Event Procedures • Set of Visual Basic instructions (code) • Tells an object how to respond to an event • Contained in the Code Editor Window The system automatically brings you to this code when event is done. Microsoft Visual Basic .NET: Reloaded

  35. HOW TO… Microsoft Visual Basic .NET: Reloaded

  36. The Code Editor Window (continued) Microsoft Visual Basic .NET: Reloaded

  37. The Code Editor Window (continued) • Class Definition • Block of code that specifies attributes and behaviors of an object • Inherits keyword • Inherits System.Windows.Forms.Form • Allows derived class to inherit attributes and behaviors of base class • Windows Form Designer generated code section • Contains code generated by the designer A windows application form inherits its ability to handle MS windows from its parent (FormS). Microsoft Visual Basic .NET: Reloaded

  38. The Code Editor Window (continued) Usually hide this stuff. Microsoft Visual Basic .NET: Reloaded

  39. Code Editor Window (continued) • Class name list box • Lists names of objects on user interface • Method name list box • Lists events selected object responds to • Procedure • Block of code that responds to an event Parts of window when we write code. Microsoft Visual Basic .NET: Reloaded

  40. The Code Editor Window (continued) Microsoft Visual Basic .NET: Reloaded

  41. Code Keyword Examples • Public class frmCommission • Public indicates class can be used by code defined outside the class • Private Sub btnExit_Click… • Sub is abbreviation for sub procedure • Block of code that performs a specific task • Private indicates procedure can be used only in class in which defined • btnExit is name of object on user interface • _Click is name of the event (Click) When you ‘click’ on the button on the form you go to the underlying code. Microsoft Visual Basic .NET: Reloaded

  42. The Me.Close Method • Instructs computer to terminate current application • Me refers to the current form • .Close refers to an intrinsic method • Part of built-in VB .NET language • Code is performed using sequential processing, also known as sequence structure Me.Close( ) Microsoft Visual Basic .NET: Reloaded

  43. The Me.Close Method (continued) Microsoft Visual Basic .NET: Reloaded

  44. Saving a Solution Microsoft Visual Basic .NET: Reloaded

  45. Starting and Ending an Application Microsoft Visual Basic .NET: Reloaded

  46. Setting the startup object If not done system will want to start in SubMain and thus will be lost! Microsoft Visual Basic .NET: Reloaded

  47. HOW TO… Microsoft Visual Basic .NET: Reloaded

  48. Starting an Application Run with no debugging – faster – will debug later. Microsoft Visual Basic .NET: Reloaded

  49. Printing Your Code Microsoft Visual Basic .NET: Reloaded

  50. Closing the Current Solution Microsoft Visual Basic .NET: Reloaded

More Related