Wednesday, 16 September 2015

Class 7 - Heading Tag

Heading tag:
There are 6 heading tags. <h1> is the biggest tag and <h6> is the smallest.
Since the text attribute is used to change the colour, the entire document will have the same colour. Whereas if you use <font color> then you can have different colours.
 <html>
<head>
<title> Worksheet 4 </title>
</head>
<body bgcolor=purple text=white>
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>
</body>
</html>


Class 8 - Inputbox




There are 4 steps in a program.
1. Declaration (dim)
2. Assign / Input the value
3. Calculation(if any)
4.Output(Msgbox/Print)


Class 8 - Activity(Pg 86)


1. Declare the integer variables x,y and z

Dim x,y,z as Integer

2. Assign values 5 to x, 10 to y and 15 to z

x=5
y=10
z=15

3. What are the values of C, N1, N2, N3 :

A=5
B=10
C=A+B
N1=A+10
N2=B
N3=5+N2

C=15( since A is 5 and B is 10)
N1=15 ( A is 5 and add 10 to it)
N2=10(B is 10)
N3=15 (N2 is 10 and add 5 to it)

3. Declare a string variable Friend, a numeric variable Num1 to store a decimal value. Assign the value 'Vedika' to the string variable created above.

dim Friend as String
dim Num1 as double

Friend = Vedika

Class 8 - Declaring a variable

Declaring a variable is used to reserve space in memory.  There are 2 types of variable declaration:
  • Implicit declaration
  • Explicit declaration
Implicit Declaration :

Whenever VB comes across a variable, it is assigned a default data type. 

Explicit Declaration :

When the user wants to specify the data type of the variable, then it is called declaring explicitly.

Dim statement is used to declare a variable.

Syntax :

dim variable name as data type

Example :

dim a,b,c as Integer
 dim m as single, i,j as Integer

String variable declaration :

String declaration is little different from other data type declaration.
There are two types of string declaration.

  • Variable Length
  • Fixed Length
If  we want to enter a data of any length then it is variable length.

dim name as string

If we want to enter a data with a particular length, then it is called fixed length.

dim name as string * 3

In the above example we can enter a string with 3 characters only.


Assigning a value :

Once the variable is assigned a data type, the value should be given to it.
To declare and assign  one variable :
dim a as integer  
a=100  

or
dim a as integer = 100

To declare more than one variable :

dim a,b,c as integer
a=10
b=20
c=30


Tuesday, 15 September 2015

Class 8 - Date Function








Class 8 - Introduction

Visual Basic

Visual basic was derived from the language BASIC. 

BASIC has its own limitations., it is a simple programming language but used only in a text based environment. But visual basic is

  • User friendly

  • Supports Graphical User Interface(GUI)VB

VB is an Event- driven programming, which means the flow of the program is determined by an Event.

An Event is an action performed either by mouse click, double click or pressing keys on the keyboard.

 Integrated Development Environment describes the interface and the environment we use to create our own applications.

 1. Form design window
 2. Tool box

 3. Menu bar

 4. Project explorer

 5. Properties window

 6. Form layout


Project Explorer Window
             
              It lists all the forms in the project. The components of the window are:
  • View code
  • View object
  • Toggle folders
  • Project name
  • Forms folder
  • form module


Properties Window

              It displays the properties like font name, caption, background colour etc of the selected object on the form.

A form is saved with an extension  .frm .
A project is saved with an extension .vbp .

        To execute the visual basic program :
  •         Click Run from Start option
  •         Click start on the Toolbar
  •         Press F5 key
                      

Class 8 - Data Type in VB

A data type determines what type of values a variable can hold.
In numbers we have different types like 5(whole number), 6.9(decimal number).

The computer memory is made up of storage areas which will hold the values. 

When we give a value to a variable, the computer will allocate space in the memory to hold the variable. The storage space will be different for different values, based on the type of value.

Data types   :

Natural Numbers 

  • byte
  • integer
  • long
Byte : Number ranges from 0 to 255.
Integer : Larger than byte. Ranges from -32,768 to 32,767
Long : It can hold more than integer. To store very large number.

Decimal Numbers 

  • Single
  • Double

Single : To store decimal values. Less Precision.
Double :  Large decimal numbers. Very precise values.

String  :
It is also called alphanumeric (i.e) alphabets and numbers. It can be a word, group of words, numbers .

Boolean :
This value can be either true or false.

Variant :
It can represent any value.

Date :
It stores vales from 1/1/100 to 12/3/9999.