Presentation is loading. Please wait.

Presentation is loading. Please wait.

2a – Object Oriented Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.

Similar presentations


Presentation on theme: "2a – Object Oriented Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming."— Presentation transcript:

1 2a – Object Oriented Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming

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.


Download ppt "2a – Object Oriented Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming."

Similar presentations


Ads by Google