EncapsulationIt is the exposure of properties and methods of anobject while hiding the actual implementation of it.In other words, the object is treated as a blackbox developers who use the object should haveno need to understand how it actually works.
Inheritanceless programming is required when adding functions tocomplex systems. This don by inherit all or some ofthe structure and/or methods in one class to another.
PolymorphismExample, a screen cursor may change its shape froman arrow to a line depending on the program mode.
Classes & objects Consider the classes at a school; children of a particular age may be grouped together and put in one class. They will all learn the same set of things and will all be tested in the same way. That doesn’t mean everyone in a class is the same – it just means there are certain things they have in common. Aly is one of the class students, so Aly is an object inside the class. Aly have a variety of properties.
IntegratedFormed or united into a whole.تكامل
DevelopmentA process in which something passes by degrees to a different stage. Darwin
Events & Actions Events are things that happen to an object. Actions are things that an object does.
SoftwareWritten programs or procedures or rules and associated documentation stored in memory. Beta Software. Alpha Software. Software Package. Systems Software. Computer Software.Documentation.
Dialog Box A small temporary window in a graphical user interface, which requestinformation from the user; after the information has been provided the user dismisses the box with `ok or `cancel‘.
Form_Load• Open new VB project• Double click on any part of the form. Form_Load Object = Form Event = Load Lets type something between private sub and end sub. Me.height = 1000 Me.width = 100 Me.opacity = 0.9
Subroutine Open new VB project. Insert button from toolbox. Double click this button. And type between private sub and end sub: – Dim prog as string ‘Declaration – Prog = “hello world” ‘Assign value for declared variable – Msgbox (prog) ‘statement
Numerical Data RangesType Storage Range of ValuesByte 1 byte 0 to 255Integer 2 bytes -32,768 to 32,767Long 4 bytes -2,147,483,648 to 2,147,483,648Single 4 bytes +/-3.402823E+38 to -1.401298E-45Double 8 bytes +/-1.79769313486232e+308 to -4.94065645841247E-324Currency 8 bytes -922,337,203,685,477.5808 to 922,337,203,685,477.5807 +/- 79,228,162,514,264,337,593,543,950,335 if no decimal isDecimal 12 bytes use +/- 7.9228162514264337593543950335 (28 decimal places).
Numerical Data Arithmetic OperationsOperator Mathematical Function+ Addition- Subtraction^ Exponential* Multiplication/ DivisionMod Modulus (return the remainder from an integer division) Integer Division (discards the decimal places) X= 13.5 Mod 12 then X = 1.5
Nonnumeric DataData Type Storage RangeString (fixed length) Length of string 1 to 65,400 characters 0 to 2 billionString (variable length) Length + 10 bytes characters January 1, 100 toDate 8 bytes December 31, 9999Boolean 2 bytes True or FalseObject 4 bytes Any embedded object Any value as large asVariant numeric 16 bytes Double Same as variable-Variant text Length+22 bytes length string
Nonnumeric Data String Manipulation• Strings can be manipulated using the ‘&’ sign and the ‘+ sign.• In Ex 1,2,3 type this code in the button sub. – Ex 1:- • Dim txt1, txt2, txt3 As String • txt1 = “hello" • txt2 = “world" • txt3 = text1 + text2 • Label1.Text = text3 ‘Output = helloworld
Nonnumeric Data String Manipulation• Ex 2:- – Dim txt1, txt3 As String – Dim Txt2 As Integer – txt1 = "VB" – txt2 = 2010 – txt3 = txt1 & txt2 – Label1.Text = text3 ‘Output = VB2010
Variable Names• The following are the rules when naming the variables in Visual Basic 2010:- 1. It must be less than 255 characters. 2. No spacing is allowed . 3. It must not begin with a number. 4. Period is not permitted. • Ex: • Student_name • X1 • ComputerName
Declaring Variables1. Assign name.2. Assign data type. • Dim variable name As Data Type • Dim variable name, variable name As Data Type1. Defines the number of characters the string can hold. • Dim variable name As String * n • where n defines the number of characters the string can hold. • Ex: Dim name As String * 10
Constants• Constants values do not change during the running of the program. – Declaring a Constant :- • Const constant name As Data Type = Value – Ex: Const Pi As Single = 3.14
Issue• We need to calculate area & circumference for:- • Circle.. • Square.. • Rectangle..Writing mathematical equations for computer