Download presentation
Presentation is loading. Please wait.
Published byAudrey Parker Modified over 9 years ago
2
What is Programming? Computer programming is about telling the computer what it is we want it to do We tell the computer what we want it to do by sending instructions to objects or passing data to / between Objects
3
Computer Components A computer is made up of many different bits of hardware and computer technology. For exampleThe Screen The Keyboard The Mouse Memory Hard disc drives Databases E Mail Systems Sound Cards
4
Why use Objects? Dealing directly with hardware can be very complicated We create things called objects which allow us to control the hardware without worrying about how the hardware works An object is a way of representing computer technology in such a way so that we send it instructions and data
5
Types of Object Web Forms and Controls Used to create the interface on – screen.NET Library Objects Ready made objects allowing us to do things such a print or send emails. Variables These objects allow us to store data in the memory of the computer Custom Objects You may create your own Objects to perform a whole host of tasks
6
Send Password We shall look at the code for “Send me my password” to see how objects may be used to control the hardware.
7
Consider the Hardware Involved! The user Types their first namethe keyboard & screen Types their second namethe keyboard & screen Enters their email addressthe keyboard & screen Presses the send password buttonthe mouse & screen The system Sends an email to the useremail message & server
8
The Click Event In design view double click the button to view the code for the click event
9
Add a Break Point A break point forces the program to stop and wait so that we may see what is happening. To do this press F9. Now try and set up a new user.
10
Things to Note Handles btnPassword.Click Sub – End Sub Comments Block comments In-Line comments
11
Stepping Through the Code The program will stop at your breakpoint and wait for further instructions. Press F10 to see how the code executes.
12
Assignment Statement Notice how the following section of code works… In this case a text box object sends data to a variable (object)
13
Sending an EMail Press F10 a few more times to see how the email is sent using the email and smtp server objects…
14
Overview of Objects Covered so far Control objectse.g. txtFirstName Used to control the interface Variable objects e.g. FirstName Used to control the RAM.NET Library objects e.g. MyEMail Used to create an e mail message
15
Properties and Methods Properties A property is used to control some setting of the object or to find out something about the object. e.g.txtFirstName.text Methods A method is a command to an object to do something The following lines of code contain a method…
16
Summary Computer programming is about telling the computer what it is we want it to do. The problem with this computer technology is that there is a huge amount of complexity involved in directly programming them. In order to get around this we use as programmers tools called objects. An object is a way of representing computer technology in such a way so that we send it instructions and data
17
Questions Objects can in theory be used to control any kind of technology. In these questions imagine that we had objects to control a toaster or a light bulb. 1. Write in your own words a definition of the word “object”. 2. In the case of an object, a method is a task that does something; a property tells us something about the state of the object. If we were to create an object to control a toaster via VB.NET what methods and properties might it have?
18
Questions 3. If a toaster object has a property called “PowerOn”, write a line of code that might turn the power on. 4. What is the = sign called that is used to transfer data around the program? 5. In the case of a light bulb object, what is wrong with the following line of VB.NET code? True = MyLightBulb.On
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.