0% found this document useful (0 votes)
40 views13 pages

Topic 3

Uploaded by

brian.mwangi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views13 pages

Topic 3

Uploaded by

brian.mwangi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Integrated development environments (IDE)

Integrated development environments is a software platform that provide programmers and developers a
comprehensive set of tools for software development in a single product. IDEs are built to work with specific
application platforms and remove barriers involved in the lifecycle of software development. IDEs are used
indevelopment teams to build new software, apps, web pages, and services, and they help by providing one tool with
all the features and removing the need for integrations. Compiling and interpreting (Transferring to computer
language)

Functions performed by the IDE

 Debugging (fixing run time or logic errors)


 Designing the user interface or application
 Writing codes
 Running the application
 Checking syntax (language) errors
 Intelligently completing code automatically

Common features of integrated development environments

1) An IDE contains a code editor, a compiler or interpreter, and a debugger, accessed through a single graphical
user interface (GUI). The user writes and edits source code in the code editor. The compiler translates the
source code into a readable language that is executable for a computer. And the debugger tests the
software to solve any issues or bugs.
2) An IDE can also contain features such as programmable editors, object and data modeling, unit testing, a
source code library and build automation tools.
3) An IDE’s toolbar which facilitates color−based organization, source−code formatting, error diagnostics and
reporting, and intelligent code completion.

Benefits of using IDEs

1) IDE improve the productivity of software developers due to their fast setup and standardization across
tools.
2) Many or even all of the necessary dev−test tools are included in one integrated development environment
and this saves time spend by developers on deciding what tools to use for various tasks, configuring the
tools and learning how to use them
3) IDEs are also designed with all their tools under one user interface. An IDE can standardize the development
process by organizing the necessary features for software development in the user interface
 statement. Delimited by Function…End Function keywords.
 Sub procedure – perform specific task but do not return a value to the calling statement.
Difference Between VB.NET and Visual Basic

VB.NET

VB.NET is also known as Visual Basic.NET. It stands for Visual Basic. Network Enabled Technologies. It is a simple,
high−level, object−oriented programming language developed by Microsoft in 2002. It is a successor of Visual Basic
6.0, which is implemented on the Microsoft .NET Framework. With this language, you can develop a fully object−
oriented application that is similar to an application created through another language such as C++, Java, or C#.

Feature of VB.NET

o Inheritance (object−oriented language)


o Delegates and events

o Parameterized constructors
o Method overloading/overriding

o Type−safe
o Delegates and events
Visual Basic

Visual Basic (VB) is a programming language developed by Microsoft in 1992. The purpose of this language is to
develop an application that can run on different versions of the Windows operating system. A Visual Basic evolved
from Basic Language; Basic language is easier to read than other languages. The final version of Visual Basic was
released in 1998. Microsoft then launched a Visual Basic DotNet ('VB.NET') language, which is much better than
Visual Basic in all aspects such as performance, reliability, working environment, easy to build, and debugging an
application.

Features of Visual Basic

o User Interface design


o Rapid Application Development
o Using this language, you can use internet or intranet services in your application.

o It has powerful database access tools, by which you can easily develop front end applications.

o It also supports ActiveX technology, in which you can access the features of other application in system
application. For example: Microsoft Word, Microsoft Excel, etc.

Difference Between VB. NET and Visual Basic

VB .NET Visual Basic

It stands for Visual Basic. Network Enables Technology. It is also developed by It is a programming language developed by Microsoft for
Microsoft, and this language was based on the .Net Framework. Furthermore, it is the fastest development of a window−based operating
specially designed for VB developers. system as well as applications.

It is a modern, fully object−oriented language that replaced VB6. VB is the predecessor of VB.NET and was not an object−
oriented language. So, it is not actively maintained.

A VB.NET uses the Common Language Runtime (CLR) component of .Net Framework Visual Basic uses the VB−Runtime environment.
at runtime. It has better features and design implementation as compared to VB−
Runtime.

It is a compiled language It is an Interpreter based language

It does not support backward compatibility. It supports backward compatibility.

It is a type−safe language. It is not a type−safe language.

In VB.NET, data is handled using the ADO.net protocol. Data Connectivity and handling are done through DAO,
RDO, and ADO (ActiveX Data Object) protocol,

Object does not support default property. The Object support default property of virtual basic.
In the VB.Net parameter are passed by a default value. In VB, most of the parameters are passed by reference.

A Multithreaded application can be developed in VB.NET. It does not support the multithread concept.

VB.Net IDE components

The full name of IDE is an Integrated Development Environment. It is a software application that allows developers
to develop, run, test and debug software.

Generally, IDE consists of a code editor, a compiler, or an integrator and a debugger.


1. Title bar

2. Menu bar

3. Tool bar

4. Toolbox

5. Code window

6. Solution explorer

7. Properties window

8. Output window

9. Error list

10. Form window

Title bar:

A title bar is the horizontal bar located the top of the screen. It includes the project name, an icon that closes visual
studio at the left and icon that minimize the group window, change the size of the group or close visual studio on
right. This component common for all window application.

Menu bar:

The menu bar is also common for all document window. It contents command required and build an application.
The main menu items have some menu items that can be chosen when needed.menubar contains
file,edit,view,debug etc…

Tool bar:

The tool bars gives us quick access to commonly used menu command. Beside the main tool bar, which is displays
by default window the menu bar, visual basic IDE provides additional tool bar for specific purpose. The four built in
tool bar are standard, edit, debug and from editor. By default, standard tool bar appear immediately below the menu
bar.

Tool box:
The tool box contains the icon of the control we can place on a form to create the application’s user interface. By
default, tool box contains a pointer icon and twenty other icon of ActiveX controls. The tool box appear at the left
side on screen by default. User can change its position anywhere on the form.

Even tool box can be turn off on screen. To place a control on a form, we first select it with a mouse and then move
the mouse over the form. When the mouse is over the form, the curser turns into a large plus sign, and we can draw
control on the form, just as we would draw a circle using a drawing application. The size of the circle determines the
size of the control.

Following table lists the Common Controls listed in the ToolBox.

Images Control Name Description

Pointer Used to move and resize controls and forms.

Button This Control triggers an action when accessed.

Check Box Control that has values either true or false

CheckedList Box Lists check box next to each item

A combination of list and text box controls that enables to select as well as
Combo Box
edit text.

DateTimePicker Display a calender picker to choose the day and date.

Label Displays a label text.

LinkLabel Displays a label with a link text.

List Box Control that lists number of items.

List View Extension of ListBox control with options to add icons,headings.

Masked Text Box Uses a Mask to differetiate proper and improper text input.

MonthCalendar Enable to select date at runtime

Notify Icon Displays an icon in the Windows Tray

NumericUpDown Allows to input a integer of specific decimal places within a specific range.

Picture Box Display image files

Progress Bar Display the progress of a task.

Radio Button Allows to choose a choice from a group of choices.

Rich TextBox Allows to edit, input rich text.

Text Box Control used to input or display text.

ToolTip Displays tooltip text.


TreeView Displays the hierarchy of nodes.

WebBrowser Allows to open an html document in form.

Properties window:

Every object has properties associated with it. The properties window is docked under the solution explorer window.
The properties window allows us to assign or change properties associated with a particular object. Properties are
attributes such as size, position etc. like a form, each control has its own set of properties. Some properties like
width, height are common to both form and controls, while other properties are unique to form or control. Control
offend differ in the number and type of properties.

Form window:

A form window used in visual basic to create project inside the form. A form window appears on screen just like grid
of dots inform of matrix. We can increase or decrease size of form window according to our need. By default, only
one form window will appear on screen but more than one form window can be open on the project window. Out
of multiple form windows, one window is called master window and other are called slave windows. By default, first
window automatically treated as master window. But user can change or select any one window as a master window.
Remaining window are automatically changed to slave window.

Code window:

Normally code window not appear on screen because it is automatically hidden. When we double click any control
in the form, a code window will open. Visual basic code window consists of two list boxes.

Both list boxes appear at the top of the code window. The left most list box is called object list box and right most
list box is called procedure list box.

Solution Explorer:

Solution Explorer is a special window that enables you to manage solutions, projects, and files. It provides a complete view of the files
in a project, and it enables you to add or remove files and to organize files into subfolders.

Error list:

The Error List window shows a list of all messages, including warnings and information, generated by Visual Studio
during the development of an application

output window:

The output window is a child window used to capture the output from user tools, find in files output, scripting output,
version control (in UEStudio), and various other areas of functionality that may write messages or output. You can
toggle the output window in the Layout tab

TYPES OF APPLICATIONS IN VB.NET

In VB.NET, you can develop different types of applications based on your requirements and use cases. Here are some
common types of applications that can be developed using VB.NET:

1. Console Applications: Console applications run in a command−line interface, where users interact with the
application by entering commands or providing input through the keyboard. They are text−based and
typically used for tasks such as data processing, automation scripts, or command−line utilities.

2. Windows Forms Applications: Windows Forms applications, also known as desktop applications, provide a
graphical user interface (GUI) that runs on the Windows operating system. These applications can include
buttons, textboxes, menus, and other controls to create interactive interfaces for users.
VB.Net - Program Structure

Before we study basic building blocks of the VB.Net programming language, let us look a bare minimum VB.Net
program structure so that we can take it as a reference in upcoming chapters.

VB.Net Hello World Example

A VB.Net program basically consists of the following parts −

 Namespace declaration

 A class or module

 One or more procedures

 Variables

 The Main procedure

 Statements & Expressions

 Comments

Imports System
Module Module1
'This program will display Hello World
Sub Main()
Console.WriteLine("Hello World")
Console.ReadKey()
End Sub
End Module
Let us look various parts of the above program −

 The first line of the program Imports System is used to include the System namespace in the program.

 The next line has a Module declaration, the module Module1. VB.Net is completely object oriented, so
every program must contain a module of a class that contains the data and procedures that your program
uses.

 Classes or Modules generally would contain more than one procedure. Procedures contain the executable
code, or in other words, they define the behavior of the class. A procedure could be any of the following −

o Function
o Sub

o Operator

o Get
o Set

o AddHandler
o RemoveHandler

o RaiseEvent

 The next line( 'This program) will be ignored by the compiler and it has been put to add additional comments
in the program.
 The next line defines the Main procedure, which is the entry point for all VB.Net programs. The Main
procedure states what the module or class will do when executed.

 The Main procedure specifies its behavior with the statement

Console.WriteLine("Hello World") WriteLine is a method of the Console class defined in the System namespace.
This statement causes the message "Hello, World!" to be displayed on the screen.

 The last line Console.ReadKey() is for the VS.NET Users. This will prevent the screen from running and
closing quickly when the program is launched from Visual Studio .NET.

Create A Project

First, you'll create a Visual Basic app project. The default project template includes all the files you'll need for a
runnable app.

1. Open Visual Studio.

2. On the start window, choose Create a new project.

3. In the Create a new project window, choose Visual Basic from the Language list. Next,
choose Windows from the Platform list and Console from the Project types list.

After you apply these language, platform, and project type filters, choose the Console App template, and then
choose Next.

4. In the Configure your new project window, enter WhatlsYourName in the Project name box. Then,
choose Next.
5. In the Additional information window, .NET 6.0 (Long-term support) should already be selected for your
target framework. If not, select .NET 6.0 (Long-term support). Then, choose Create.

Visual Studio opens your new project.

Run the app

After you select your Visual Basic project template and name your project, Visual Studio creates a Program.vb file.
The default code calls the WriteLine method to display the literal string "Hello World!" in the console window.

There are two ways to run this code, inside Visual Studio in debug mode, and from your computer as a
regular standalone app.

Run the app in debug mode

1. Select the WhatIsYourName button or press F5 to run the default code in Debug mode.

2. When the app runs in the Microsoft Visual Studio Debug Console, "Hello World!" displays. Press any key to
close the debug console window and end the app:
Run the app as a standalone

To see the output outside of Visual Studio, in a system console window, build and run the executable (.exe file).

1. In the Build menu, choose Build Solution.

2. In Solution Explorer, right−click on WhatIsYourName and choose Open File in File Explorer.

3. In File Explorer, navigate to the bin\Debug\net6.0 directory and run WhatIsYourName.exe.

4. The Main procedure terminates after its single statement executes and the console window closes
immediately. To keep the console visible until the user presses a key, see the next section.

Add code to ask for user input

Next, you'll add Visual Basic code that prompts you for your name and then displays it along with the current date
and time. In addition, you'll add code that pauses the console window until the user presses a key.

1. Enter the following Visual Basic code after the Sub Main(args As String()) line and before the End Sub line,
replacing the WriteLine line:

Console.Write("Please enter your name: ")


Dim name = Console.ReadLine()
Dim currentDate = DateTime.Now
Console.WriteLine($"Hello, {name}, on {currentDate:d} at {currentDate:t}")
Console.Write("Press any key to continue...")
Console.ReadKey(True)

 Write and WriteLine write a string to the console.

 ReadLine reads input from the console, in this case a string.

 DateTime represents a datetime, and Now returns the current time.

 ReadKey() pauses the app and waits for a keypress.


2. Select the WhatIsYourName button or press F5 to build and run your app in Debug mode.

3. When the debug console window opens, enter your name. Your console window should look similar to the
following screenshot:

4. Press any key to end the app, and then press any key to close the debug console window.

Extra credit: Add two numbers

This example shows how to read in numbers, rather than a string, and do some arithmetic. Try changing your code
from:

Module Program
Public num1 As Integer
Public num2 As Integer
Public answer As Integer
Sub Main(args As String())
Console.Write("Type a number and press Enter")
num1 = Console.ReadLine()
Console.Write("Type another number to add to it and press Enter")
num2 = Console.ReadLine()
answer = num1 + num2
Console.WriteLine("The answer is " & answer)
Console.Write("Press any key to continue...")
Console.ReadKey(True)
End Sub
End Module

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.

When we consider a VB.Net program, it can be defined as a collection of objects that communicate via invoking each
other's methods. Let us now briefly look into what do class, object, methods and instance variables mean.

1) Object − Objects have states and behaviors. Example: A dog has states − color, name, breed as well as
behaviors − wagging, barking, eating, etc. An object is an instance of a class.
2) Class − A class can be defined as a template/blueprint that describes the
behaviors/states that objects of its type support.
3) Methods − A method is basically a behavior. A class can contain many methods. It is in
methods where the
logics are written, data is manipulated and all the actions are executed.
4) Instance Variables − Each object has its unique set of instance variables.
An object's state is created by the values assigned to these instance
variables.
5) Method. is a separate code block that will contain a series of statements
to perform particular operations. Generally, visual basic Methods are
useful to improve the code reusability by reducing code duplication.
6) Namespaces. organize the objects defined in an assembly. Assemblies can
contain multiple namespaces, which can in turn contain other
namespaces. Namespaces prevent ambiguity and simplify references
whenusing large groups of objects such as class libraries.
7) Exception handling. An exception is a problem that arises during the
execution of a program. An exception is a response to an exceptional
circumstance that arises while a program is running, such as an attempt to
divide by zero.
8) Garbage collection. Objects usually have a lifetime, which is managed
through garbage collection. When an objects gets into scope, it occupies
memory and must release that memory once it gets out of scope. Released
object references are automatically reclaimed by the operating system.
Garbage collection is therefore the process of reclaiming memory when
the CLR decides that the object references are no longerin use.

Advantages of Garbage Collection

Garbage Collection provides the following benefits –

 You don’t need to free memory manually while developing your application.
 It also allocates objects on the managed heap efficiently.
 When objects are no longer used then it will reclaim those objects by
clearing their memory, and keeps thememory available for future
allocations.
 Managed objects automatically get clean content to start with, so
their constructors do not have toinitialize every data field.
 It also provides memory safety by making sure that an object cannot use the content of
another object.

Conditions for Garbage Collection

Garbage collection occurs when one of the following conditions is true.

 The system has low physical memory.


 The memory that is used by allocated objects on the managed heap
surpasses an acceptable threshold. Thisthreshold is continuously adjusted
as the process runs.
 The Garbage Collect method is called and in almost all cases, you do not
have to call this method, becausethe garbage collector runs continuously.
This method is primarily used for unique situations and testing.
9) Procedures- Procedures allow logical grouping of code into tasks. When a
complex application is divided into procedures, the code become more
flexible and easier to maintain and debug. Advantages ofProcedures
 The code in a procedure is reusable – created and tested procedure
can be called from different placesin the application
 The application is easier to debug and maintain because source of
errors in a procedure are easier to trace than in entire application.
Types of procedures

There are two types of procedures;

i. Function procedure – perform a specific task and return a value to the calling statement.
Delimited by
Function…End Function keywords.
ii. Sub procedure – perform specific task but do not return a value to the calling statement

You might also like