1 / 7

2a – Object Oriented

2a – Object Oriented. CSCI N331 VB .NET Programming. Lingma Acheson. Department of Computer and Information Science, IUPUI. Object Oriented. Focus on Objects Objects in the real world Car iPod nano Button Label Picture …

ami
Download Presentation

2a – Object Oriented

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. 2a – Object Oriented CSCI N331 VB .NET Programming Lingma Acheson Department of Computer and Information Science, IUPUI

  2. Object Oriented • Focus on Objects • Objects in the real world • Car • iPod nano • Button • Label • Picture • … • Must give the details of an object to let people know about that particular object

  3. Objects • Can do something to the object • Car: drive, wash, reverse, park, … • iPod nano: play songs, delete songs, charge, … • Picture: display, frame, copy, … • Defining an object means designing a blue print for the object, e.g. what properties should it have, what can it do? • Can manufacture lots of objects from the same blue print, but with different properties

  4. Objects in VB .NET • Any language inside Visual Studio are object oriented. E.g. VB.NET objects: Labels, Textboxes, Buttons, Forms, Checkboxes… • Download, unzip and open the “Inventory” project. • Double clicking on the Form frame or clicking on the “View Code” icon in Solution Explorer will bring up the code window.

  5. Define an Object • An object in VB .NET is defined by creating a “Class” (the blue print) • The objects in the Toolbox are already defined in Visual Studio, thus are ready to use. E.g. Textbox properties: • What is the name of the textbox? • What is the text shown in the textbox? • What is the size of the textbox? • What is the background color? • What is the font and color of the text inside the box? • …

  6. Create an Object Instance • Creating a new object means creating an instance of a particular Class (type). E.g. Creating three textboxes means creating three textbox objects of the Class “Textbox”. • Once we create an object, we can manipulate the properties of the object and decide on the behavior of the object. • E.g. the behavior of a button – once the user click on the button, it will calculate the total and display in the Total textbox. - a “button click” event.

  7. Summary • An object in VB .NET shares the same concept as a real world object. • A Class means a blue print of the object. • Creating an object means creating an instance based on the blue print. • Once an object is created, we can change the properties of the object. • We can also define the events.

More Related