Download Computer Science Useful Resources
Explore structured advanced study materials through the Application of .NET Technology Unit 06 Introduction to Programming with Visual Basic.NET Notes Set 01. Tailored for learners, utilizing these Computer Science resources ensures thorough preparation and strengthens foundational knowledge before final evaluations.
Access Study Guides and Summaries
View or download the dedicated Application of .NET Technology Unit 06 Introduction to Programming with Visual Basic.NET Notes Set 01 resource below. Engaging with these advanced study guides under focused conditions ensures continuous academic progress and mastery of the 2026-27 curriculum for .NET Technology.
This page introduces Visual Basic .NET: its features, the Visual Studio IDE, the structure of a program and the keyword list, followed by the basics of identifiers, data types, variables, constants and enumerations. It also covers writing functions in VB.Net with return values, recursion, param arrays and array arguments.
Overview
Visual Basic .NET (VB.NET) is an object-oriented computer programming language implemented on the .NET Framework. Although it is an evolution of classic Visual Basic language, it is not backwards-compatible with VB6, and any code written in the old version does not compile under VB.NET.
Like all other .NET languages, VB.NET has complete support for object-oriented concepts. Everything in VB.NET is an object, including all of the primitive types (Short, Integer, Long, String, Boolean, etc.) and user-defined types, events, and even assemblies. All objects inherit from the base class Object.
These are the following reasons that make VB.Net a widely used professional language:
1. Modern, general purpose.
2. Object oriented.
3. Component oriented.
4. Easy to learn.
5. Structured language.
6. It produces efficient programs.
7. It can be compiled on a variety of computer platforms.
8. Part of .Net Framework.
VB.Net has numerous strong programming features that make it endearing to a multitude of programmers worldwide. Some of the features are:
1. Boolean conditions,
2. Automatic Garbage Collection,
3. Standard Library,
4. Assembly Versioning,
5. Properties and Events,
6. Delegates and Events Management,
7. Easy-to-use Generics,
8. Indexers,
9. Conditional Compilation,
10. Simple Multithreading.
Integrated Development Environment (IDE)
The Visual Studio product family shares a single Integrated Development Environment (IDE) that is composed of several elements: the Menu bar, Standard toolbar, various tool windows docked or auto-hidden on the left, bottom, and right sides, as well as the editor space. The tool windows, menus, and toolbars available depend on the type of project or file you are working in.
The Integrated Development Environment allows the automation of many of the common programming tasks in one environment:
1. Writing the code.
2. Checking for syntax (language) errors.
3. Compiling and interpreting (transferring to computer language).
4. Debugging (fixing run-time or logic errors).
5. Running the application.
Microsoft provides the following development tools for VB.Net programming:
1. Visual Studio 2010 (VS).
2. Visual Basic 2010 Express (VBE).
3. Visual Web Developer.
Program Structure
A VB.Net program basically consists of the following parts:
1. Namespace declaration.
2. A class or module.
3. One or more procedures.
4. Variables.
5. The Main procedure.
6. Statements and expressions.
7. Comments.
Let us look at a simple code that would print the words "Hello World":
Imports System
Module Module1
'This program will display Hello World
Sub Main()
Console.WriteLine("Hello World")
Console.ReadKey()
End Sub
End ModuleWhen the code is compiled and executed, it produces the following result:
Hello World
VB .NET code can be structured as a module definition, form definition, or class definition.
1. Module definition begins with "Module" and ends with "End Module".
2. Form definition is used to create a GUI.
3. Class definition is written to represent an object.
Classes or Modules generally would contain more than one procedure. Procedures contain the executable code, or in other words, they define the behaviour of the class. A procedure could be any of the following:
1. Function.
2. Sub.
3. Operator.
4. Get.
5. Set.
6. AddHandler.
7. RemoveHandler.
8. RaiseEvent.
Writing a VB .NET Module Definition
VB .NET code is not case sensitive. VB .NET compiler does not require indentation of code, but good programming practice encourages indentation. The following table lists the VB .NET keywords and operator symbols.
| AddHandler | AddressOf | Alias | And |
| AndAlso | As | Boolean | ByRef |
| Byte | ByVal | Call | Case |
| Catch | CBool | CByte | CChar |
| CDate | CDbl | CDec | Char |
| CInt | Class Constraint | Class Statement | CLng |
| CObj | Const | Continue | CSByte |
| CShort | CSng | CStr | CType |
| CUInt | CULng | CUShort | Date |
| Decimal | Declare | Default | Delegate |
| Dim | DirectCast | Do | Double |
| Each | Else | ElseIf | End Statement |
| End <keyword> | EndIf | Enum | Erase |
| Error | Event | Exit | False |
| Finally | For (in For...Next) | For Each...Next | Friend |
| Function | Get | GetType | GetXMLNamespace |
| Global | GoSub | GoTo | Handles |
| If | If() | Implements | Implements Statement |
| Imports (.NET Namespace and Type) | Imports (XML Namespace) | In | In (Generic Modifier) |
| Inherits | Integer | Interface | Is |
| IsNot | Let | Lib | Like |
| Long | Loop | Me | Mod |
| Module | Module Statement | MustInherit | MustOverride |
| MyBase | MyClass | Namespace | Narrowing |
| New Constraint | New Operator | Next | Next (in Resume) |
| Not | Nothing | NotInheritable | NotOverridable |
| Object | Of | On | Operator |
| Option | Optional | Or | OrElse |
| Out (Generic Modifier) | Overloads | Overridable | Overrides |
| ParamArray | Partial | Private | Property |
| Protected | Public | RaiseEvent | ReadOnly |
| ReDim | REM | RemoveHandler | Resume |
| Return | SByte | Select | Set |
| Shadows | Shared | Short | Single |
| Static | Step | Stop | String |
| Structure Constraint | Structure Statement | Sub | SyncLock |
| Then | Throw | To | True |
| Try | TryCast | TypeOf...Is | UInteger |
| ULong | UShort | Using | Variant |
| Wend | When | While | Widening |
| With | WithEvents | WriteOnly | Xor |
| #Const | #Else | #ElseIf | #End |
| #If | = | & | &= |
| * | *= | / | /= |
| \ | \= | ^ | ^= |
| + | += | - | -= |
| >> | >>= | << | <<= |
The VB .NET statements consist of keywords and identifiers. Keywords have special meanings to VB .NET. VB .NET identifiers are the names assigned by the programmer to modules, procedures, and variables, etc.
VB .NET identifiers:
1. Can be of any length.
2. Can include any letter or number, but no spaces.
3. Must begin with a letter.
Comment lines:
1. Add explanations to code.
2. Are ignored by compiler.
3. Begin with a single quote (').
Many statements invoke a method to do some work. Information sent to a method is called an argument. A literal is a value defined within a statement.
Compile and Execute a VB .Net Program
These are the steps to compile and execute a simple VB .Net program:
1. Start Visual Studio.
2. On the menu bar, choose File, New, Project.
3. Choose Visual Basic from templates.
4. Choose Console Application.
5. Specify a name and location for your project using the Browse button, and then choose the OK button.
6. The new project appears in Solution Explorer.
7. Write code in the Code Editor.
8. Click the Run button or the F5 key to run the project.
9. A Command Prompt window appears that contains the line Hello World.
VB .Net Basic Syntax
VB.Net is an object oriented programming language. In Object Oriented Programming methodology, a program consists of various objects that interact with each other by means of actions. The actions that an object may take are called methods. Objects of the same kind are said to have the same type or, more often, are said to be in the same class.
Object
1. Objects have states and behaviors.
2. Example: A dog has states - color, name, breed as well as behaviors - wagging, barking, eating, etc.
3. An object is an instance of a class.
Class
1. A class can be defined as a template/blueprint that describes the behaviors/states that objects of its type support.
Methods
1. A method is basically a behavior.
2. A class can contain many methods.
3. It is in methods where the logic is written, data is manipulated and all the actions are executed.
Instance Variables
1. Each object has its unique set of instance variables.
2. An object's state is created by the values assigned to these instance variables.
Member Variables
1. Variables are attributes or data members of a class, used for storing data.
2. For example, a Rectangle class can have two member variables named length and width.
Member Functions
1. Functions are a set of statements that perform a specific task.
2. The member functions of a class are declared within the class.
3. A sample class Rectangle can contain three member functions: AcceptDetails, GetArea and Display.
Instantiating a class
1. A class such as ExecuteRectangle can contain the Main() method and instantiate the Rectangle class.
Identifiers
An identifier is a name used to identify a class, variable, function, or any other user-defined item. The basic rules for naming classes in VB.Net are as follows:
1. A name must begin with a letter that could be followed by a sequence of letters, digits (0 - 9) or underscore.
2. The first character in an identifier cannot be a digit.
3. It must not contain any embedded space or symbol like ? - + ! @ # % ^ & * ( ) [ ] { } . ; : " ' / and \.
4. However an underscore ( _ ) can be used.
5. It should not be a reserved keyword.
Data Types
Data types refer to an extensive system used for declaring variables or functions of different types. The type of a variable determines how much space it occupies in storage and how the bit pattern stored is interpreted. VB.Net provides a wide range of data types:
1. Boolean.
2. Byte.
3. Char.
4. Date.
5. Decimal.
6. Double.
7. Integer.
8. Long.
9. Object.
10. SByte.
11. Short.
12. Single.
13. String.
14. UInteger.
15. ULong.
16. User-defined.
17. UShort.
Variables
A variable is nothing but a name given to a storage area that our programs can manipulate. Each variable in VB.Net has a specific type, which determines the size and layout of the variable's memory; the range of values that can be stored within that memory; and the set of operations that can be applied to the variable. The basic value types provided in VB.Net can be categorized as:
| Type | Example |
|---|---|
| Integral types | SByte, Byte, Short, UShort, Integer, UInteger, Long, ULong and Char |
| Floating point types | Single and Double |
| Decimal types | Decimal |
| Boolean types | True or False values, as assigned |
| Date types | Date |
VB.Net also allows defining other value types of variable like Enum and reference types of variables like Class.
Variable Declaration in VB .Net - Dim Statement
The Dim statement is used for variable declaration and storage allocation for one or more variables. The Dim statement is used at module, class, structure, procedure or block level. Syntax for variable declaration in VB.Net is:
[ <attributelist> ] [ accessmodifier ] [[ Shared ] [ Shadows ] | [ Static ]] [ ReadOnly ] Dim [ WithEvents ] variablelist
1. Attributelist is a list of attributes that apply to the variable. Optional.
2. Accessmodifier defines the access levels of the variables, it has values as - Public, Protected, Friend, Protected Friend and Private. Optional.
3. Shared declares a shared variable, which is not associated with any specific instance of a class or structure, rather available to all the instances of the class or structure. Optional.
4. Shadows indicate that the variable re-declares and hides an identically named element, or set of overloaded elements, in a base class. Optional.
5. Static indicates that the variable will retain its value, even after termination of the procedure in which it is declared. Optional.
6. ReadOnly means the variable can be read, but not written. Optional.
7. WithEvents specifies that the variable is used to respond to events raised by the instance assigned to the variable. Optional.
8. Variablelist provides the list of variables declared.
Variable Declaration in VB .Net
variablename[ ( [ boundslist ] ) ] [ As [ New ] datatype ] [ = initializer ]
1. Variablename: is the name of the variable.
2. Boundslist: optional. It provides list of bounds of each dimension of an array variable.
3. New: optional. It creates a new instance of the class when the Dim statement runs.
4. Datatype: Required if Option Strict is On. It specifies the data type of the variable.
5. Initializer: Optional if New is not specified. Expression that is evaluated and assigned to the variable when it is created.
Some valid variable declarations along with their definition are shown here:
Dim StudentID As Integer Dim StudentName As String Dim Salary As Double Dim count1, count2 As Integer Dim status As Boolean Dim exitButton As New System.Windows.Forms.Button Dim lastTime, nextTime As Date
Variable Initialization in VB .Net
Variables are initialized (assigned a value) with an equal sign followed by a constant expression. The general form of initialization is:
variable_name = value
For example:
Dim pi As Double pi = 3.14159
You can initialize a variable at the time of declaration as follows:
Dim StudentID As Integer = 100 Dim StudentName As String = "Bill Smith"
Example:
Module variablesNdataypes
Sub Main()
Dim a As Short
Dim b As Integer
Dim c As Double
a = 10
b = 20
c = a + b
Console.WriteLine("a = {0}, b = {1}, c = {2}", a, b, c)
Console.ReadLine()
End Sub
End ModuleAccepting Values from User
The Console class in the System namespace provides a function ReadLine for accepting input from the user and store it into a variable. For example:
Dim message As String message = Console.ReadLine
The following example demonstrates it:
Module variablesNdataypes
Sub Main()
Dim message As String
Console.Write("Enter message: ")
message = Console.ReadLine
Console.WriteLine()
Console.WriteLine("Your Message: {0}", message)
Console.ReadLine()
End Sub
End ModuleWhen the above code is compiled and executed, it produces the following result (assume the user inputs Hello World):
Enter message: Hello World Your Message: Hello World
Constants
The constants refer to fixed values that the program may not alter during its execution. These fixed values are also called literals. Constants can be of any of the basic data types like an integer constant, a floating constant, a character constant, or a string literal. There are also enumeration constants as well.
The constants are treated just like regular variables except that their values cannot be modified after their definition. In VB.Net, constants are declared using the Const statement. The Const statement is used at module, class, structure, procedure, or block level for use in place of literal values. The syntax for the Const statement is:
[ <attributelist> ] [ accessmodifier ] [ Shadows ] Const constantlist
1. attributelist: specifies the list of attributes applied to the constants; you can provide multiple attributes, separated by commas. Optional.
2. accessmodifier: specifies which code can access these constants. Optional. Values can be either of the: Public, Protected, Friend, Protected Friend, or Private.
3. Shadows: this makes the constant hide a programming element of identical name, in a base class. Optional.
4. Constantlist: gives the list of names of constants declared. Required.
Where, each constant name has the following syntax and parts:
constantname [ As datatype ] = initializer
1. constantname: specifies the name of the constant.
2. datatype: specifies the data type of the constant.
3. initializer: specifies the value assigned to the constant.
Enumerations
An enumeration is a set of named integer constants. An enumerated type is declared using the Enum statement. The Enum statement declares an enumeration and defines the values of its members. The Enum statement can be used at the module, class, structure, procedure, or block level. The syntax for the Enum statement is as follows:
[ <attributelist> ] [ accessmodifier ] [ Shadows ]
Enum enumerationname [ As datatype ]
memberlist
End Enum1. Attributelist: refers to the list of attributes applied to the variable. Optional.
2. Accessmodifier: specifies which code can access these enumerations. Optional. Values can be either of the: Public, Protected, Friend or Private.
3. Shadows: this makes the enumeration hide a programming element of identical name, in a base class. Optional.
4. Enumerationname: name of the enumeration. Required.
5. Datatype: specifies the data type of the enumeration and all its members.
6. Memberlist: specifies the list of member constants being declared in this statement. Required.
Each member in the memberlist has the following syntax and parts:
[<attribute list>] membername [ = initializer ]
1. name: specifies the name of the member. Required.
2. initializer: value assigned to the enumeration member. Optional.
Functions
The Function statement is used to declare the name, parameter and the body of a function. The syntax for the Function statement is:
[Modifiers] Function FunctionName [(ParameterList)] As ReturnType
[Statements]
End Function1. Modifiers: Specify the access level of the function; possible values are: Public, Private, Protected, Friend, Protected Friend and information regarding overloading, overriding, sharing, and shadowing.
2. FunctionName: Indicates the name of the function.
3. ParameterList: Specifies the list of the parameters.
4. ReturnType: Specifies the data type of the variable the function returns.
Function Returning a value
In VB.Net, a function can return a value to the calling code in two ways:
1. By using the return statement,
2. By assigning the value to the function name.
The following example demonstrates using the FindMax function:
Module myfunctions
Function FindMax(ByVal num1 As Integer, ByVal num2 As Integer) As Integer
' local variable declaration
Dim result As Integer
If (num1 > num2) Then
result = num1
Else
result = num2
End If
FindMax = result
End Function
Sub Main()
Dim a As Integer = 100
Dim b As Integer = 200
Dim res As Integer
res = FindMax(a, b)
Console.WriteLine("Max value is : {0}", res)
Console.ReadLine()
End Sub
End ModuleWhen the above code is compiled and executed, it produces the following result:
Max value is : 200
Recursive Function
A function can call itself. This is known as recursion. Following is an example that calculates factorial for a given number using a recursive function:
Module myfunctions
Function factorial(ByVal num As Integer) As Integer
' local variable declaration
Dim result As Integer
If (num = 1) Then
Return 1
Else
result = factorial(num - 1) * num
Return result
End If
End Function
Sub Main()
'calling the factorial method
Console.WriteLine("Factorial of 6 is : {0}", factorial(6))
Console.WriteLine("Factorial of 7 is : {0}", factorial(7))
Console.WriteLine("Factorial of 8 is : {0}", factorial(8))
Console.ReadLine()
End Sub
End ModuleParam Arrays
At times, while declaring a function or sub procedure, you are not sure of the number of arguments passed as a parameter. VB.Net param arrays (or parameter arrays) come into help at these times. The following example demonstrates using the Param Arrays:
Module myparamfunc
Function AddElements(ParamArray arr As Integer()) As Integer
Dim sum As Integer = 0
Dim i As Integer = 0
For Each i In arr
sum += i
Next i
Return sum
End Function
Sub Main()
Dim sum As Integer
sum = AddElements(512, 720, 250, 567, 889)
Console.WriteLine("The sum is: {0}", sum)
Console.ReadLine()
End Sub
End ModuleWhen the above code is compiled and executed, it produces the following result:
The sum is: 2938
Passing Arrays as Function Arguments
You can pass an array as a function argument in VB.Net. The following example demonstrates passing arrays as function arguments:
Module arrayParameter
Function getAverage(ByVal arr As Integer(), ByVal size As Integer) As Double
Dim i As Integer
Dim avg As Double
Dim sum As Integer = 0
For i = 0 To size - 1
sum += arr(i)
Next i
avg = sum / size
Return avg
End Function
Sub Main()
Dim balance As Integer() = {1000, 2, 3, 17, 50}
Dim avg As Double
avg = getAverage(balance, 5)
Console.WriteLine("Average value is: {0} ", avg)
Console.ReadLine()
End Sub
End ModuleWhen the above code is compiled and executed, it produces the following result:
Average value is: 214.4
Free study material for Computer Science
Computer Science Exam Resources: .NET Technology
Essential Notes for Computer Science
Access comprehensive study material for .NET Technology, including revision notes, concept maps, and high-probability questions. These resources are designed in alignment with the latest 2026 CBSE syllabus for Computer Science to support effective exam preparation.
Verified Solutions for Computer Science
Built using official NCERT guidelines for Computer Science, these materials provide reliable academic support. Integrating past examination questions and step-by-step solutions helps students understand official CBSE grading criteria.
Enhance Accuracy with Online Tests
Wrap up your chapter revision by testing your knowledge against standard objective question formats. Explore our full library of free, up-to-date sample papers and online assessments to secure top grades in your CBSE examinations.
FAQs
The latest 2026-27 advanced study resources for Computer Science are available for free on StudiesToday.com which includes NCERT Exemplars, high-order thinking skills (HOTS) questions, and deep-dive concept summaries.
Our exhaustive Computer Science package includes chapter wise revision notes, solved practice sheets, important formulas and Concept Maps to help in better understanding of all topics.
Yes. For , our resources have been developed to help you get better marks in school exams and also build fundamental strength needed for entrance tests including Competency Based learning.
in , students should use Active Recall method, read the concept summary, then solve the Important Questions section without looking at the answers and then check your answers.
All Computer Science study materials are provided in mobile-friendly PDF. You can download and save them on your device.
Yes, our team has ensured that all Computer Science materials for are strictly aligned with the National Education Policy (NEP) 2020 and the latest 2026-27 syllabus.