SlideShare a Scribd company logo
VISUAL BASIC
Dr. Kamal Gulati
What is Visual Basic?
•The "Visual" part refers to the method used
to create the graphical user interface (GUI).
Rather than writing numerous lines of code to
describe the appearance and location of
interface elements, you simply add pre-built
objects into place on screen
•The "Basic" part refers to the BASIC
(Beginners All-Purpose Symbolic Instruction
Code) language
Visual Basic Characteristics
• Rapid Application Development (RAD) tool
• Front-end applications.
•ActiveX technologies allow you to use the functionality
provided by other applications, such as Microsoft Word
word processor, Microsoft Excel spreadsheet, and other
Windows applications.
•Your finished application is a true .exe file.
Event-Driven programming Language?
In an event-driven application, the code doesn't follow a
predetermined path — it executes different code sections in
response to events.
Events can be triggered by the user's actions, by messages
from the system or other applications, or even from the
application itself.
The sequence of these events determines the sequence in
which the code executes, thus the path through the
application's code differs each time the program runs.
Your code can also trigger events during execution. For
example, programmatically changing the text in a text box
cause the text box's Change event to occur.

Recommended for you

Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming

This document introduces C programming and provides an overview of programming languages. It discusses that programming languages can be categorized into machine language, assembly language, and high-level languages. C programming is then introduced, including that it was developed in 1970, standardized in 1989, and used to develop UNIX. The basic structure of a C program is outlined including the documentation, link, definition, main, and subprogram sections.

c programtype of programmingprogramming
C# programming language
C# programming languageC# programming language
C# programming language

Brief introduction of C#, overview of c# , what is c# highlights of c#, why c# is better, code to take input in c#

how to take input in c#c#simple program structure of c#
Introduction to programming using Visual Basic 6
Introduction to programming using Visual Basic 6Introduction to programming using Visual Basic 6
Introduction to programming using Visual Basic 6

This document provides an introduction to programming using Visual Basic 6.0. It discusses why VB is a good choice for beginners, describes the basic VB integrated development environment interface and components like forms, objects, and properties. It then walks through a "Hello World" example program to demonstrate creating a form with labels, buttons, and event procedures. The document provides details on formatting text, adding images and colors, and using message boxes before concluding with a suggestion for a pizza ordering program project.

introduction to programming using visual basic 6vbvisualbasic
Interactive Development
The traditional application development process can be broken
into three distinct steps: writing, compiling, and testing code.
Unlike traditional languages, Visual Basic uses an interactive
approach to development, blurring the distinction between the
three steps.
With most languages, if you make a mistake in writing your
code, the error is caught by the compiler when you start to
compile your application. You must then find and fix the error
and begin the compile cycle again, repeating the process for
each error found.
Visual Basic interprets your code as you enter it, catching and
highlighting most syntax or spelling errors on the fly.
In addition to catching errors on the fly, Visual Basic also
partially compiles the code as it is entered. If the compiler
finds an error, it is highlighted in your code. You can fix the
error and continue compiling without having to start over.
Because of the interactive nature of Visual Basic, you'll find
yourself running your application frequently as you develop
it. This way you can test the effects of your code as you
work rather than waiting to compile later.
The Integrated Development Environment
Selecting the Project Type
Introduction to Visual Basic

Recommended for you

Introduction to c#
Introduction to c#Introduction to c#
Introduction to c#

C# is a component-oriented programming language that builds on the .NET framework. It has a familiar C-like syntax that is easy for developers familiar with C, C++, Java, and Visual Basic to adopt. C# is fully object-oriented and optimized for building .NET applications. Everything in C# belongs to a class, with basic data types including integers, floats, booleans, characters, and strings. C# supports common programming constructs like variables, conditional statements, loops, methods, and classes. C# can be easily combined with ASP.NET for building web applications in a powerful, fast, and high-level way.

Notification android
Notification androidNotification android
Notification android

This is about Android Notification and in which you see how you create your own notification and default notification.

notificationandroid notificationandroid
Threads And Synchronization in C#
Threads And Synchronization in C#Threads And Synchronization in C#
Threads And Synchronization in C#

Threads And Synchronization in C# Concept about Threads And Synchronization in C# it will help you about this concept feel free Download free programming applications on http://www.androidapplications.xyz

c#htmlcoding
Working with Visual Basic Projects
A project consists of :
•One project file that keeps track of all the components (.vbp).
•One file for each form (.frm).
•One binary data file for each form containing data for properties of
controls on the form (.frx). These files are not editable and are
automatically generated for any .frm file that contains binary
properties, such as Picture or Icon.
•Optionally, one file for each class module (.cls).
•Optionally, one file for each standard module (.bas).
The project file is simply a list of all the files and objects associated
with the project, as well as information on the environment options
you set.
You can convert the project into an executable file (.exe)
Form Modules
Form modules (.frm file name extension) can contain textual
descriptions of the form and its controls, including their property
settings. They also contain form-level declarations of constants,
variables and procedures; event procedures; and general
procedures.
Class Modules
Class modules (.cls file name extension) are similar to form modules,
except that they have no visible user interface. You can use class
modules to create your own objects, including code for methods and
properties.
Standard Modules
Standard modules (.bas file name extension) can contain public or
module-level declarations of types, constants, variables, external
procedures, and public procedures.
Variables
Variable is a placeholder in memory.
Variables are used to temporarily store values during the execution
of an application.
Variables have a name (the word you use to refer to the value the
variable contains) and a data type (which determines the kind of
data the variable can store).
A variable name:
•Must begin with a letter.
•Can't contain an embedded period.
•Must not exceed 255 characters.
•Must be unique within the same scope, which is the range from
which the variable can be referenced — a procedure, a form, and so
on.
Implicit Declaration
You don't have to declare a variable before using it.
Visual Basic automatically creates a variable with that name, which
you can use as if you had explicitly declared it. While this is
convenient, it can lead to subtle errors in your code if you misspell a
variable name.
Example:
x = “Sam”
a = 45
Explicit Declaration
To avoid the problem of misnaming variables, you can stipulate that
Visual Basic always warn you whenever it encounters a name not
declared explicitly as a variable.
Place this statement in the Declarations section of a class, form, or

Recommended for you

Algo>Abstract data type
Algo>Abstract data typeAlgo>Abstract data type
Algo>Abstract data type

Abstract data types (ADTs) define a data type in terms of its possible values and operations, independent of implementation details. An ADT consists of a logical form defining the data items and operations, and a physical form comprising the data structures and algorithms that implement it. Simple data types like integers and characters are ADTs with basic storage structures like memory locations and operations implemented by hardware/software. More complex ADTs require user-defined data structures to organize data in memory or files along with subroutines implementing each operation.

Introduction To C#
Introduction To C#Introduction To C#
Introduction To C#

This document provides an introduction and overview of the C# programming language. It discusses prerequisites, learning objectives, and the agenda. It covers Hello World examples, design goals of C#, types including value types and reference types, program structure, statements, operators, and using Visual Studio and the .NET framework. Key topics are the unified type system in C#, value types vs reference types, boxing and unboxing, predefined types like integers and strings, and object being the root type.

c
Vb introduction.
Vb introduction.Vb introduction.
Vb introduction.

This document provides an overview of the history and development of the Visual Basic programming language. It discusses how Visual Basic originated from the BASIC language in the 1960s and was later adapted for microcomputers by Bill Gates and Paul Allen in the 1970s. Every version of Basic since has been based on their early work. Visual Basic was then introduced by Microsoft in 1991 and continued to be updated with new features and capabilities in subsequent versions like Visual Basic 3.0, 4.0, 5.0 and 6.0. The document also defines some key Visual Basic concepts and terms.

Scope of Variables
A variable is scoped as either a procedure-level (local) or module-
level variable.
Scope
Procedure-level
Private: Variables are private to the procedure in which they
appear.
Public: Not applicable. You cannot declare public variables
within a procedure.
Module-level
Private: Variables are private to the module in which they
appear.
Public: Variables are available to all modules.
The Variant Data Type
Variant variables can hold any type of data described so far, and then
some.
Variables of this type take 16 bytes, in this format:
Bytes 0 and 1 hold an integer value that states which type of data is
stored in bytes 8 through 15.
Bytes 2 through 7 are unused (with only one exception, the Decimal
subtype), and in most cases not all the bytes in the second half of the
variable are used.
For example, if a Variant holds an Integer value, the first two bytes
contain the value 2-vbInteger, bytes 8 and 9 hold the actual 16-bit value,
and all other bytes are unused.
Variables Used Within a Procedure
You declare them with the Dim or Static keywords.
For example:
Dim intTemp As Integer
or
Static intPermanent As Integer
Variables Used Within a Module
You create module-level variables by declaring them with the
Private keyword in the Declarations section at the top of the
module.
Private intTemp As Integer
At the module level, there is no difference between Private and
Dim, but Private is preferred because it readily contrasts with
Public and makes your code easier to understand.
Variables Used by All Modules
To make a module-level variable available to other modules,
use the Public keyword to declare the variable.
The values in public variables are available to all procedures
in your application. Like all module-level variables,
Public variables are declared in the Declarations section at the
top of the module.
Public intTemp As Integer

Recommended for you

JAVA AWT
JAVA AWTJAVA AWT
JAVA AWT

a brief introduction to java AWT and graphics programming and also covers topics included with layouts and components.

abstract window toolkitjavajava awt
vb.net Constructor and destructor
vb.net Constructor and destructorvb.net Constructor and destructor
vb.net Constructor and destructor

The document discusses constructors and destructors in VB.NET. It explains that a constructor is called whenever a new object is created and is used to initialize the object. It has the name "New" and no return type. A destructor, called Finalize in VB.NET, is automatically called when an object is destroyed to perform cleanup tasks like closing files. Examples are provided to demonstrate default and parameterized constructors, as well as destructors.

Graphical User Interface in JAVA
Graphical User Interface in JAVAGraphical User Interface in JAVA
Graphical User Interface in JAVA

This document discusses graphical user interface (GUI) components in Java and layout managers. It provides descriptions of common GUI components like JLabel, JTextField, JButton, JCheckBox, and JComboBox. It then explains several layout managers - BorderLayout, CardLayout, FlowLayout, GridLayout, GridBagLayout, GroupLayout, and SpringLayout - and provides their class declarations.

Constants
The syntax for declaring a constant is:
[Public|Private] Const constantname[As type] = expression
A Const statement can represent a mathematical or date/time
quantity:
Const conPi = 3.14159
Public Const conMaxPlanets As Integer = 9
Const conReleaseDate = #1/1/95#
Const conCodeName = "Enigma"
You can place more than one constant declaration on a single line if
you separate them with commas:
Public Const conPi = 3.14, conMaxPlanets = 9
Data Types
By default, if you don't supply a data type, the variable is given the
Variant data type.
The Variant data type can represent many different data types in
different situations.
Declaring Variables with Data Types
You must use Private, Public, Dim or Static statement to declare it As
type.
Numeric Data Types
Visual Basic supplies several numeric data types
— Byte, Integer, Long
Single (single-precision floating point), Double (double-precision
floating point), and Currency.
The String Data Type
Private S As String
S = "Database"
You specify a fixed-length string with this syntax:
String * size
For example, to declare a string that is always 50 characters long, use
code like this:
Dim EmpName As String * 50
The Boolean Data Type
If you have a variable that will contain simple true/false
The default value of Boolean is False.
Dim blnRunning As Boolean
The Date Data Type
Date and time values can be contained both in the specific Date data type
and in Variant variables.
The Object Data Type
Object variables are stored as 32-bit (4-byte) addresses that refer to
objects within an application or within some other application.
A variable declared as Object is one that can subsequently be assigned
(using the Set statement) to refer to any actual object recognized by the
application.

Recommended for you

1 .java basic
1 .java basic1 .java basic
1 .java basic

Java is a programming language and platform that allows developers to write programs once and run them anywhere. The document discusses Java's history, features, and provides examples of Java code. It defines Java as a simple, secure, platform-independent language and describes how to write a basic "Hello World" Java program. It also explains how to set the path variable so Java tools like javac and java can be run from any directory.

Menu bars and menus
Menu bars and menusMenu bars and menus
Menu bars and menus

The document discusses menu bars and menus in Java. It explains that a menu bar displays a list of top-level menu choices, with each choice associated with a drop-down menu. This is implemented using the MenuBar, Menu, and MenuItem classes. Menus can contain other menus and menu items. The document provides examples of how to construct menus and menu items, add them to the menu bar, and handle events when items are selected. It includes a full program example that creates a menu bar with file and edit menus for performing operations like cut, copy, paste, and for toggling debug and test modes.

RichControl in Asp.net
RichControl in Asp.netRichControl in Asp.net
RichControl in Asp.net

The document discusses several rich controls in ASP.NET including the AdRotator, File Upload, Multiview, Calendar, and Wizard controls. It provides descriptions of each control and examples of how to use their key properties. Some key advantages of rich controls mentioned are that they are flexible, reduce code needs, and improve performance by combining standard controls into a single control.

Converting Data Types
Conversion functions to convert values into a specific data type.
Conversion function Converts an expression to
Cbool Boolean
Cbyte Byte
Ccur Currency
Cdate Date
CDbl Double
Cint Integer
CLng Long
CSng Single
CStr String
Cvar Variant
Arrays
Fixed-Size Arrays
When declaring an array, follow the array name by the upper bound in
parentheses.
The upper bound cannot exceed the range of a Long data type
(-2,147,483,648 to 2,147,483,647).
For example
Dim Counters(14) As Integer ' 15
elements.
To specify a lower bound, provide it explicitly using the To
keyword:
Dim Sums(100 To 120) As String
Multidimensional Arrays
Dim MatrixA(9, 9) As Double
Either or both dimensions can be declared with explicit lower bounds:
Dim MatrixA(1 To 10, 1 To 10) As Double
Dynamic Arrays
A dynamic array can be resized at any time.
To create a dynamic array
1. Declare the array as dynamic by giving it an empty dimension
list.Dim DynArray()
2. Allocate the actual number of elements with a ReDim
statement.ReDim DynArray(X + 1)
The ReDim statement can appear only in a procedure.
Unlike the Dim and Static statements, ReDim is an executable
statement — it makes the application carry out an action at run time.
Each ReDim can change the number of elements,
as well as the lower and upper bounds.
ReDim DynArray(4 to 12)

Recommended for you

JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity

how to make connection to database using jdbc, step by step connection, types of driver available, jdbc data source.

java data base connectivityjdbcjava data base
C# Tutorial
C# Tutorial C# Tutorial
C# Tutorial

This document provides an introduction and overview of C# programming and SQL. It discusses key aspects of C#, its uses in Windows, web, and web service applications. It also covers SQL fundamentals like retrieving, inserting, updating, and deleting records. The document includes examples of SQL statements like INSERT, UPDATE, DELETE, and SELECT and highlights best practices like enclosing string values in single quotes and ending statements with semicolons.

I x scripting
I x scriptingI x scripting
I x scripting

The document provides an overview of a two-day training course on C# scripting for an iX HMI solution. Day 1 covers basic C# concepts like variables, data types, flow control, methods, exceptions, arrays, and debugging. Day 2 focuses on scripting specifically for the iX platform, including accessing tags, screens, services, and more. Specific topics covered include script modules, events, file access, timers, serial ports, and referencing external assemblies.

Preserving the Contents of Dynamic Arrays
Each time you execute the ReDim statement, all the values currently
stored in the array are lost.
Sometimes you may want to change the size of the array without losing
the data in the array.
You can do this by using ReDim with the Preserve keyword.
ReDim Preserve DynArray(UBound(DynArray) + 1)
User-Defined Types
A user-defined type (UDT) is a compound data structure that holds
several variables of simpler data types.
Before you can use a UDT variable, you must first define its structure,
using a Type directive in the declaration section of a module:
Private Type EmployeeUDT
Name As String Department
ID As Long
Salary As Double
End Type
The Type statement can be used only at module level.
Private Type EmployeeRecord ' Create user-defined type.
ID As Integer ' Define elements of data type.
Name As String * 20
Address As String * 30
Phone As Long
End Type
Private Sub Form_Load()
Dim MyRecord As EmployeeRecord ' Declare variable.
' Assignment to EmployeeRecord variable must occur in a
procedure.
MyRecord.ID = 12003
MsgBox MyRecord.ID
End Sub
Mathematical Operators
Operator Meaning
+, - Unary positive, negative
+ Addition
- Subtraction
* Multiplication
/ Division
^ exponentiation
Interestingly, the division operator (/) always converts both its operands
to Double, which can cause some unexpected overhead.
If you're dividing an Integer or Long number by another Integer or Long
number and you aren't interested in the decimal part of the quotient, you
should use the integer division operator (), which executes faster:

Recommended for you

E learning excel vba programming lesson 3
E learning excel vba programming  lesson 3E learning excel vba programming  lesson 3
E learning excel vba programming lesson 3

The document discusses VBA procedures and data types. It defines sub procedures and functions, explaining that functions can return values while subs do not. Examples are provided of how to write subs and functions. The document also discusses public and private procedures, and different variable data types in VBA like Byte, Boolean, Integer, Long, Currency, Single, Double, Date, String, Object, and Variant. It provides the valid value ranges for each data type. The next class will cover all the data types with examples.

excel vba programming
AVB201.1 MS Access VBA Module 1
AVB201.1 MS Access VBA Module 1AVB201.1 MS Access VBA Module 1
AVB201.1 MS Access VBA Module 1

The document outlines the topics covered in an introductory Visual Basic for Applications (VBA) course for Microsoft Access. The 3-hour sessions cover event-driven programming in Access, VBA language constructs and programming techniques, and working programmatically with data. Key concepts discussed include using the VBA editor, differentiating between functions and sub procedures, variable scope, and built-in VBA functions. Interactive exercises are provided to help learn organizing code and using functions.

vbaaccess
Ms vb
Ms vbMs vb
Ms vb

Visual Basic is an event-driven programming language developed by Microsoft. It was introduced in 1991 and helped popularize graphical user interface (GUI) programming. Some key points: - The original BASIC language was developed in the 1960s and was simpler than other languages at the time like FORTRAN. - Bill Gates and Paul Allen wrote the first BASIC for microcomputers in the 1970s, which became the foundation for later versions like GW-BASIC and QBASIC. - Visual Basic 6.0 introduced improvements like a faster compiler and support for database integration and internet capabilities. - It uses an integrated development environment (IDE) and is based on creating and linking together objects to build Windows applications and

Comparison Operators
Visual Basic supports six comparison operators, which can be applied to
both numeric and string operands:
= < <= > >= <>
Boolean
Visual Basic for Applications supports a few Boolean operators,
which are especially useful for combining multiple Boolean
subexpressions.
The operators used most frequently are
AND, OR, XOR, and NOT.
Rounding and Truncating
The Int function truncates a number to the integer value equal or lower
than its argument.
Print Int(1.2) ' Displays "1"
Print Int(-1.2) ' Displays "-2"
The function that actually truncates the decimal part of a number is Fix:
Print Fix(1.2) ' Displays "1“
Print Fix(-1.2) ' Displays "-1"
Round, which lets you round a decimal number to the number of
digits you want (or to the nearest integer, if the second argument
is omitted):
Print Round(1.45) ' Displays "1"
Print Round(1.55) ' Displays "2"
Round cont…..
When the fractional part is exactly 0.5, it rounds up if the
integer portion is an odd number and rounds down if it's
even:
Print Round(1.5), Round(2.5) ' Both display "2".
Breaking a Single Statement Into Multiple Lines
You can break a long statement into multiple lines in the Code window
using the line-continuation character (a space followed by an
underscore).
Using this character can make your code easier to read, both online and
when printed.
S = _
"SELECT * FROM Titles, Publishers" _
& "WHERE Publishers.PubId = Titles.PubID" _
& "AND Publishers.State = 'CA'"
You can't follow a line-continuation character with a comment on the
same line.

Recommended for you

Notes how to work with variables, constants and do calculations
Notes how to work with variables, constants and do calculationsNotes how to work with variables, constants and do calculations
Notes how to work with variables, constants and do calculations

1. The document discusses different ways of storing and working with data in a Visual C++ application, including variables, constants, arrays, and structures. 2. It explains the differences between local and global scope for variables and constants, and shows examples of declaring identifiers in each scope. 3. The document also demonstrates how to convert between data types like string and double when retrieving user input and performing calculations.

ASP.Net Technologies Part-2
ASP.Net Technologies Part-2ASP.Net Technologies Part-2
ASP.Net Technologies Part-2

This presentation covers the syllabus of Himachal Pradesh University for the subject of ASP.NET Technologies. This is part -2 of a syllabus. This is particularly for BCA students.

.net.net frameworkactive server pages
PRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdfPRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdf

This document discusses algorithms, flowcharts, pseudocode, and data types in programming. It defines an algorithm as a step-by-step procedure to solve problems. Pseudocode uses natural language to describe an algorithm, while a flowchart provides a graphical representation. The document also discusses using flowcharts and pseudocode in the planning process, and defines common data types like integer, string, boolean and their uses in programming.

Combining Statements on One Line
You can place two or more statements on a line if you use a
colon (:) to separate them:
Text1.Text = "Hello" : Red = 255
In order to make your code more readable, however, it's better
to place each statement on a separate line.
Adding Comments to Your Code
As you read through the examples in this guide, you'll often
come across the comment symbol ('). This symbol tells Visual
Basic to ignore the words that follow it.
Procedures
These can be of type Sub or Function, depending on whether they
return a value to the caller.
Each procedure has a unique name, a scope, a list of expected
arguments, and—if it's a function—a return value.
Scope can be Private, Public, or Friend.
A Private procedure can be invoked only from within the module in
which it's defined.
A Public procedure can be invoked from outside the module.
A Friend procedure is halfway between Private and Public: Such a
procedure can be called from anywhere in the current project, but
not from outside it. This difference becomes important only if you're
within a project of a type other than Standard EXE, one that
therefore exposes its classes to other applications in the form of
COM components.
Control Flow Branch Statements
If...Then
If condition Then statement
If condition Then
statements
End If
If...Then...Else
If condition1 Then
[statementblock-1]
[ElseIf condition2 Then
[statementblock-2]] ...
[Else
[statementblock-n]]
End If
' Single line version, without Else clause
If x > 0 Then y = x
' Single line version, with Else clause
If x > 0 Then y = x Else y = 0
' Single line, but with multiple statements separated by colons
If x > 0 Then y = x: x = 0 Else y = 0

Recommended for you

Pc module1
Pc module1Pc module1
Pc module1

A flow chart is a graphical representation of a process using different symbols to represent each step linked by arrows. An algorithm is a step-by-step method to solve a problem or make decisions. The main differences between an algorithm and flowchart are that an algorithm is a set of rules to solve a problem while a flowchart is a diagram that visually represents an algorithm. C programming variables must be declared with a data type and can be initialized with a starting value. Variables can be declared locally inside functions or globally outside any functions.

01 Database Management (re-uploaded)
01 Database Management (re-uploaded)01 Database Management (re-uploaded)
01 Database Management (re-uploaded)

Visual Basic 6 allows developers to design graphical user interfaces and connect to databases. It uses an event-driven programming model where code executes in response to user and system events like button clicks. The document discusses connecting a VB application to a Microsoft Access database using ActiveX Data Objects (ADO). Developers add an ADO Data Control to the form, specify the database file path in its connection string, and select the table as the record source. Common ADO commands allow navigating and updating the recordset. Visual Basic provides a visual interface for building Windows applications and integrating with databases through controls like ADO.

Ppt on visual basics
Ppt on visual basicsPpt on visual basics
Ppt on visual basics

Visual Basic 6 allows developers to design graphical user interfaces and connect to databases. It uses an event-driven programming model where code executes in response to user and system events like button clicks. The document discusses connecting a VB application to a Microsoft Access database using ActiveX Data Objects (ADO). Developers add an ADO Data Control to the form, specify the database file path in its connection string, and select the table as the record source. Common ADO commands allow navigating and updating the recordset. Visual Basic provides a visual interface for building Windows applications and integrating with databases through ADO.

' Multiline version of the above code (more readable)
If x > 0 Then
y = x
x = 0
Else
y = 0
End If
' An example of If..ElseIf..Else block
If x > 0 Then
y = x
ElseIf x < 0 Then
y = x * x
Else ' X is surely 0, no need to actually test it.
x = -1
End If
Select Case
A Select Case statement provides capability similar to the If...Then...Else
statement, but it makes code more readable when there are several
choices.
Select Case testexpression
[Case expressionlist1
[statementblock-1]]
[Case expressionlist2
[statementblock-2]]
.
.
.
[Case Else
[statementblock-n]]
End Select
The Select Case statement is less versatile than the If block in that it
can test only one expression against a list of values:
Select Case Mid$(Text, i, 1)
Case "0" To "9"
' It's a digit.
Case "A" To "Z", "a" To "z"
' It's a letter.
Case ".", ",", " ", ";", ":", "?"
' It's a punctuation symbol or a space.
Case Else
' It's something else.
End Select
Loop Structures
Do While condition
statements
Loop
Do
statements
Loop While condition
Do
statements
Loop Until condition
While condition
[statements]
Wend

Recommended for you

Csharp
CsharpCsharp
Csharp

The document discusses elements of the .NET framework including CLR, class libraries, data and XML support, web services, web forms, and windows forms. It also covers assembly manifests, how .NET applications are compiled and executed, the base class library, value types vs reference types, and garbage collection. Key points include that the CLR allows managed code to run in a common language runtime, class libraries provide reusable functionality, and the assembly manifest contains metadata about an assembly.

Unit 1 introduction to visual basic programming
Unit 1 introduction to visual basic programmingUnit 1 introduction to visual basic programming
Unit 1 introduction to visual basic programming

This document provides an introduction to visual basic programming, covering topics such as variables, data types, operators, flow control, procedures, arrays, strings, and exception handling. It discusses the visual studio integrated development environment and its key components. It defines variables and data types, and covers implicit and explicit type conversions. Control flow structures like conditional statements, selection statements, and iteration statements are explained. Procedures such as subroutines and functions are defined. Finally, it provides examples of arrays and strings.

Technical Interview
Technical InterviewTechnical Interview
Technical Interview

The document provides information about preparing for a technical interview, including: - Check the company profile, areas of interest, and domain to understand what may be asked. - Be prepared to discuss your fundamental computer engineering knowledge as well as one or two subjects you are interested in and knowledgeable about. - Also prepare to discuss your past project work and the latest technologies. - Key topics that may be covered include C, C++, data structures, algorithms, databases, operating systems, networks, and various programming languages. - Understanding pointers, memory allocation functions, structures, unions, classes, inheritance and polymorphism in C/C++ is also important for technical interviews.

computer engineeringtechnical interviewtechnical concept
For...Next
The syntax is:
For counter = start To end [Step increment]
statements
Next [counter]
The arguments counter, start, end, and increment are all numeric.
For Each...Next
Syntax :
For Each element In group
statements
Next element
IIf Function
Returns one of two parts, depending on the evaluation of an expression.
Syntax
IIf (expr, truepart, falsepart)
expr. Expression you want to evaluate.
truepart. Value or expression returned if expr is True.
falsepart. Value or expression returned if expr is False.
IIf always evaluates both truepart and falsepart, even though it returns
only one of them. Because of this, you should watch for undesirable side
effects.
For example, if evaluating falsepart results in a division by zero error, an
error occurs even if expr is True.
With Statement
Executes a series of statements on a single object or a user defined type.
Syntax
With object
[statements]
End With
Example:
With MyObject
.Height = 100 ' Same as MyObject.Height = 100.
.Caption = "Hello" ' Same as MyObject.Caption = "Hello".
With .Font
.Color = Red ' Same as MyObject.Font.Color = Red.
.Bold = True ' Same as MyObject.Font.Bold = True.
End With

More Related Content

What's hot

4.C#
4.C#4.C#
visual basic v6 introduction
visual basic v6 introductionvisual basic v6 introduction
visual basic v6 introduction
bloodyedge03
 
Java Programming
Java ProgrammingJava Programming
Java Programming
Anjan Mahanta
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
Manoj Tyagi
 
C# programming language
C# programming languageC# programming language
C# programming language
swarnapatil
 
Introduction to programming using Visual Basic 6
Introduction to programming using Visual Basic 6Introduction to programming using Visual Basic 6
Introduction to programming using Visual Basic 6
Jeanie Arnoco
 
Introduction to c#
Introduction to c#Introduction to c#
Notification android
Notification androidNotification android
Notification android
ksheerod shri toshniwal
 
Threads And Synchronization in C#
Threads And Synchronization in C#Threads And Synchronization in C#
Threads And Synchronization in C#
Rizwan Ali
 
Algo>Abstract data type
Algo>Abstract data typeAlgo>Abstract data type
Algo>Abstract data type
Ain-ul-Moiz Khawaja
 
Introduction To C#
Introduction To C#Introduction To C#
Introduction To C#
SAMIR BHOGAYTA
 
Vb introduction.
Vb introduction.Vb introduction.
Vb introduction.
sagaroceanic11
 
JAVA AWT
JAVA AWTJAVA AWT
JAVA AWT
shanmuga rajan
 
vb.net Constructor and destructor
vb.net Constructor and destructorvb.net Constructor and destructor
vb.net Constructor and destructor
suraj pandey
 
Graphical User Interface in JAVA
Graphical User Interface in JAVAGraphical User Interface in JAVA
Graphical User Interface in JAVA
suraj pandey
 
1 .java basic
1 .java basic1 .java basic
1 .java basic
Indu Sharma Bhardwaj
 
Menu bars and menus
Menu bars and menusMenu bars and menus
Menu bars and menus
myrajendra
 
RichControl in Asp.net
RichControl in Asp.netRichControl in Asp.net
RichControl in Asp.net
Bhumivaghasiya
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
Tanmoy Barman
 
C# Tutorial
C# Tutorial C# Tutorial
C# Tutorial
Jm Ramos
 

What's hot (20)

4.C#
4.C#4.C#
4.C#
 
visual basic v6 introduction
visual basic v6 introductionvisual basic v6 introduction
visual basic v6 introduction
 
Java Programming
Java ProgrammingJava Programming
Java Programming
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
C# programming language
C# programming languageC# programming language
C# programming language
 
Introduction to programming using Visual Basic 6
Introduction to programming using Visual Basic 6Introduction to programming using Visual Basic 6
Introduction to programming using Visual Basic 6
 
Introduction to c#
Introduction to c#Introduction to c#
Introduction to c#
 
Notification android
Notification androidNotification android
Notification android
 
Threads And Synchronization in C#
Threads And Synchronization in C#Threads And Synchronization in C#
Threads And Synchronization in C#
 
Algo>Abstract data type
Algo>Abstract data typeAlgo>Abstract data type
Algo>Abstract data type
 
Introduction To C#
Introduction To C#Introduction To C#
Introduction To C#
 
Vb introduction.
Vb introduction.Vb introduction.
Vb introduction.
 
JAVA AWT
JAVA AWTJAVA AWT
JAVA AWT
 
vb.net Constructor and destructor
vb.net Constructor and destructorvb.net Constructor and destructor
vb.net Constructor and destructor
 
Graphical User Interface in JAVA
Graphical User Interface in JAVAGraphical User Interface in JAVA
Graphical User Interface in JAVA
 
1 .java basic
1 .java basic1 .java basic
1 .java basic
 
Menu bars and menus
Menu bars and menusMenu bars and menus
Menu bars and menus
 
RichControl in Asp.net
RichControl in Asp.netRichControl in Asp.net
RichControl in Asp.net
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
 
C# Tutorial
C# Tutorial C# Tutorial
C# Tutorial
 

Similar to Introduction to Visual Basic

I x scripting
I x scriptingI x scripting
I x scripting
Alex do Amaral Dias
 
E learning excel vba programming lesson 3
E learning excel vba programming  lesson 3E learning excel vba programming  lesson 3
E learning excel vba programming lesson 3
Vijay Perepa
 
AVB201.1 MS Access VBA Module 1
AVB201.1 MS Access VBA Module 1AVB201.1 MS Access VBA Module 1
AVB201.1 MS Access VBA Module 1
guest38bf
 
Ms vb
Ms vbMs vb
Ms vb
sirjade4
 
Notes how to work with variables, constants and do calculations
Notes how to work with variables, constants and do calculationsNotes how to work with variables, constants and do calculations
Notes how to work with variables, constants and do calculations
William Olivier
 
ASP.Net Technologies Part-2
ASP.Net Technologies Part-2ASP.Net Technologies Part-2
ASP.Net Technologies Part-2
Vasudev Sharma
 
PRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdfPRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdf
jaymaraltamera
 
Pc module1
Pc module1Pc module1
Pc module1
SANTOSH RATH
 
01 Database Management (re-uploaded)
01 Database Management (re-uploaded)01 Database Management (re-uploaded)
01 Database Management (re-uploaded)
bluejayjunior
 
Ppt on visual basics
Ppt on visual basicsPpt on visual basics
Ppt on visual basics
younganand
 
Csharp
CsharpCsharp
Csharp
vinayabburi
 
Unit 1 introduction to visual basic programming
Unit 1 introduction to visual basic programmingUnit 1 introduction to visual basic programming
Unit 1 introduction to visual basic programming
Abha Damani
 
Technical Interview
Technical InterviewTechnical Interview
Technical Interview
prashant patel
 
Generics
GenericsGenerics
Programming concepts By ZAK
Programming concepts By ZAKProgramming concepts By ZAK
Programming concepts By ZAK
Tabsheer Hasan
 
c#.pptx
c#.pptxc#.pptx
Library management system
Library management systemLibrary management system
Library management system
SHARDA SHARAN
 
Lesson 5 PP
Lesson 5 PPLesson 5 PP
Lesson 5 PP
Linda Bodrie
 
Ppt lesson 05
Ppt lesson 05Ppt lesson 05
Ppt lesson 05
Linda Bodrie
 
Problem Solving Techniques
Problem Solving TechniquesProblem Solving Techniques
Problem Solving Techniques
Ashesh R
 

Similar to Introduction to Visual Basic (20)

I x scripting
I x scriptingI x scripting
I x scripting
 
E learning excel vba programming lesson 3
E learning excel vba programming  lesson 3E learning excel vba programming  lesson 3
E learning excel vba programming lesson 3
 
AVB201.1 MS Access VBA Module 1
AVB201.1 MS Access VBA Module 1AVB201.1 MS Access VBA Module 1
AVB201.1 MS Access VBA Module 1
 
Ms vb
Ms vbMs vb
Ms vb
 
Notes how to work with variables, constants and do calculations
Notes how to work with variables, constants and do calculationsNotes how to work with variables, constants and do calculations
Notes how to work with variables, constants and do calculations
 
ASP.Net Technologies Part-2
ASP.Net Technologies Part-2ASP.Net Technologies Part-2
ASP.Net Technologies Part-2
 
PRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdfPRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdf
 
Pc module1
Pc module1Pc module1
Pc module1
 
01 Database Management (re-uploaded)
01 Database Management (re-uploaded)01 Database Management (re-uploaded)
01 Database Management (re-uploaded)
 
Ppt on visual basics
Ppt on visual basicsPpt on visual basics
Ppt on visual basics
 
Csharp
CsharpCsharp
Csharp
 
Unit 1 introduction to visual basic programming
Unit 1 introduction to visual basic programmingUnit 1 introduction to visual basic programming
Unit 1 introduction to visual basic programming
 
Technical Interview
Technical InterviewTechnical Interview
Technical Interview
 
Generics
GenericsGenerics
Generics
 
Programming concepts By ZAK
Programming concepts By ZAKProgramming concepts By ZAK
Programming concepts By ZAK
 
c#.pptx
c#.pptxc#.pptx
c#.pptx
 
Library management system
Library management systemLibrary management system
Library management system
 
Lesson 5 PP
Lesson 5 PPLesson 5 PP
Lesson 5 PP
 
Ppt lesson 05
Ppt lesson 05Ppt lesson 05
Ppt lesson 05
 
Problem Solving Techniques
Problem Solving TechniquesProblem Solving Techniques
Problem Solving Techniques
 

More from Amity University | FMS - DU | IMT | Stratford University | KKMI International Institute | AIMA | DTU

All About DBMS - Interview Question and Answers
All About DBMS - Interview Question and AnswersAll About DBMS - Interview Question and Answers
Concept of Governance - Management of Operational Risk for IT Officers/Execut...
Concept of Governance - Management of Operational Risk for IT Officers/Execut...Concept of Governance - Management of Operational Risk for IT Officers/Execut...
Concept of Governance - Management of Operational Risk for IT Officers/Execut...
Amity University | FMS - DU | IMT | Stratford University | KKMI International Institute | AIMA | DTU
 
Emerging Technologies in IT
Emerging Technologies in ITEmerging Technologies in IT
Introduction to DBMS - Notes in Layman...
Introduction to DBMS - Notes in Layman...Introduction to DBMS - Notes in Layman...
Fundamentals of DBMS
Fundamentals of DBMSFundamentals of DBMS
CASE (Computer Aided Software Design)
CASE (Computer Aided Software Design)CASE (Computer Aided Software Design)
SOFTWARE RELIABILITY AND QUALITY ASSURANCE
SOFTWARE RELIABILITY AND QUALITY ASSURANCESOFTWARE RELIABILITY AND QUALITY ASSURANCE
Software Testing (Contd..) SDLC Model
Software Testing (Contd..) SDLC ModelSoftware Testing (Contd..) SDLC Model
Software Testing - SDLC Model
Software Testing - SDLC ModelSoftware Testing - SDLC Model
Coding - SDLC Model
Coding - SDLC ModelCoding - SDLC Model
Software Design - SDLC Model
Software Design - SDLC ModelSoftware Design - SDLC Model
Models of SDLC (Contd..) & Feasibility Study
Models of SDLC (Contd..)  & Feasibility StudyModels of SDLC (Contd..)  & Feasibility Study
Models of SDLC (Software Development Life Cycle / Program Development Life Cy...
Models of SDLC (Software Development Life Cycle / Program Development Life Cy...Models of SDLC (Software Development Life Cycle / Program Development Life Cy...
Models of SDLC (Software Development Life Cycle / Program Development Life Cy...
Amity University | FMS - DU | IMT | Stratford University | KKMI International Institute | AIMA | DTU
 
Introduction to Software Engineering
Introduction to Software EngineeringIntroduction to Software Engineering
CLOUD SECURITY IN INSURANCE INDUSTRY WITH RESPECT TO INDIAN MARKET
CLOUD SECURITY IN INSURANCE INDUSTRY WITH RESPECT TO INDIAN MARKETCLOUD SECURITY IN INSURANCE INDUSTRY WITH RESPECT TO INDIAN MARKET
CLOUD SECURITY IN INSURANCE INDUSTRY WITH RESPECT TO INDIAN MARKET
Amity University | FMS - DU | IMT | Stratford University | KKMI International Institute | AIMA | DTU
 
Application Software
Application SoftwareApplication Software
Application Software – Horizontal & Vertical Software
Application Software – Horizontal & Vertical SoftwareApplication Software – Horizontal & Vertical Software
Software: Systems and Application Software
Software:  Systems and Application SoftwareSoftware:  Systems and Application Software
Programming Languages
Programming LanguagesProgramming Languages
Number Codes and Registers
Number Codes and RegistersNumber Codes and Registers

More from Amity University | FMS - DU | IMT | Stratford University | KKMI International Institute | AIMA | DTU (20)

All About DBMS - Interview Question and Answers
All About DBMS - Interview Question and AnswersAll About DBMS - Interview Question and Answers
All About DBMS - Interview Question and Answers
 
Concept of Governance - Management of Operational Risk for IT Officers/Execut...
Concept of Governance - Management of Operational Risk for IT Officers/Execut...Concept of Governance - Management of Operational Risk for IT Officers/Execut...
Concept of Governance - Management of Operational Risk for IT Officers/Execut...
 
Emerging Technologies in IT
Emerging Technologies in ITEmerging Technologies in IT
Emerging Technologies in IT
 
Introduction to DBMS - Notes in Layman...
Introduction to DBMS - Notes in Layman...Introduction to DBMS - Notes in Layman...
Introduction to DBMS - Notes in Layman...
 
Fundamentals of DBMS
Fundamentals of DBMSFundamentals of DBMS
Fundamentals of DBMS
 
CASE (Computer Aided Software Design)
CASE (Computer Aided Software Design)CASE (Computer Aided Software Design)
CASE (Computer Aided Software Design)
 
SOFTWARE RELIABILITY AND QUALITY ASSURANCE
SOFTWARE RELIABILITY AND QUALITY ASSURANCESOFTWARE RELIABILITY AND QUALITY ASSURANCE
SOFTWARE RELIABILITY AND QUALITY ASSURANCE
 
Software Testing (Contd..) SDLC Model
Software Testing (Contd..) SDLC ModelSoftware Testing (Contd..) SDLC Model
Software Testing (Contd..) SDLC Model
 
Software Testing - SDLC Model
Software Testing - SDLC ModelSoftware Testing - SDLC Model
Software Testing - SDLC Model
 
Coding - SDLC Model
Coding - SDLC ModelCoding - SDLC Model
Coding - SDLC Model
 
Software Design - SDLC Model
Software Design - SDLC ModelSoftware Design - SDLC Model
Software Design - SDLC Model
 
Models of SDLC (Contd..) & Feasibility Study
Models of SDLC (Contd..)  & Feasibility StudyModels of SDLC (Contd..)  & Feasibility Study
Models of SDLC (Contd..) & Feasibility Study
 
Models of SDLC (Software Development Life Cycle / Program Development Life Cy...
Models of SDLC (Software Development Life Cycle / Program Development Life Cy...Models of SDLC (Software Development Life Cycle / Program Development Life Cy...
Models of SDLC (Software Development Life Cycle / Program Development Life Cy...
 
Introduction to Software Engineering
Introduction to Software EngineeringIntroduction to Software Engineering
Introduction to Software Engineering
 
CLOUD SECURITY IN INSURANCE INDUSTRY WITH RESPECT TO INDIAN MARKET
CLOUD SECURITY IN INSURANCE INDUSTRY WITH RESPECT TO INDIAN MARKETCLOUD SECURITY IN INSURANCE INDUSTRY WITH RESPECT TO INDIAN MARKET
CLOUD SECURITY IN INSURANCE INDUSTRY WITH RESPECT TO INDIAN MARKET
 
Application Software
Application SoftwareApplication Software
Application Software
 
Application Software – Horizontal & Vertical Software
Application Software – Horizontal & Vertical SoftwareApplication Software – Horizontal & Vertical Software
Application Software – Horizontal & Vertical Software
 
Software: Systems and Application Software
Software:  Systems and Application SoftwareSoftware:  Systems and Application Software
Software: Systems and Application Software
 
Programming Languages
Programming LanguagesProgramming Languages
Programming Languages
 
Number Codes and Registers
Number Codes and RegistersNumber Codes and Registers
Number Codes and Registers
 

Recently uploaded

(T.L.E.) Agriculture: Essentials of Gardening
(T.L.E.) Agriculture: Essentials of Gardening(T.L.E.) Agriculture: Essentials of Gardening
(T.L.E.) Agriculture: Essentials of Gardening
MJDuyan
 
Is Email Marketing Really Effective In 2024?
Is Email Marketing Really Effective In 2024?Is Email Marketing Really Effective In 2024?
Is Email Marketing Really Effective In 2024?
Rakesh Jalan
 
The basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxThe basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptx
heathfieldcps1
 
2024 KWL Back 2 School Summer Conference
2024 KWL Back 2 School Summer Conference2024 KWL Back 2 School Summer Conference
2024 KWL Back 2 School Summer Conference
KlettWorldLanguages
 
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 12 - GLOBAL SUCCESS - FORM MỚI 2025 - HK1 (C...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 12 - GLOBAL SUCCESS - FORM MỚI 2025 - HK1 (C...CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 12 - GLOBAL SUCCESS - FORM MỚI 2025 - HK1 (C...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 12 - GLOBAL SUCCESS - FORM MỚI 2025 - HK1 (C...
Nguyen Thanh Tu Collection
 
SYBCOM SEM III UNIT 1 INTRODUCTION TO ADVERTISING
SYBCOM SEM III UNIT 1 INTRODUCTION TO ADVERTISINGSYBCOM SEM III UNIT 1 INTRODUCTION TO ADVERTISING
SYBCOM SEM III UNIT 1 INTRODUCTION TO ADVERTISING
Dr Vijay Vishwakarma
 
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
marianell3076
 
NLC Grade 3.................................... ppt.pptx
NLC Grade 3.................................... ppt.pptxNLC Grade 3.................................... ppt.pptx
NLC Grade 3.................................... ppt.pptx
MichelleDeLaCruz93
 
Lecture_Notes_Unit4_Chapter_8_9_10_RDBMS for the students affiliated by alaga...
Lecture_Notes_Unit4_Chapter_8_9_10_RDBMS for the students affiliated by alaga...Lecture_Notes_Unit4_Chapter_8_9_10_RDBMS for the students affiliated by alaga...
Lecture_Notes_Unit4_Chapter_8_9_10_RDBMS for the students affiliated by alaga...
Murugan Solaiyappan
 
Final_SD_Session3_Ferriols, Ador Dionisio, Fajardo.pptx
Final_SD_Session3_Ferriols, Ador Dionisio, Fajardo.pptxFinal_SD_Session3_Ferriols, Ador Dionisio, Fajardo.pptx
Final_SD_Session3_Ferriols, Ador Dionisio, Fajardo.pptx
shimeathdelrosario1
 
Webinar Innovative assessments for SOcial Emotional Skills
Webinar Innovative assessments for SOcial Emotional SkillsWebinar Innovative assessments for SOcial Emotional Skills
Webinar Innovative assessments for SOcial Emotional Skills
EduSkills OECD
 
How to Handle the Separate Discount Account on Invoice in Odoo 17
How to Handle the Separate Discount Account on Invoice in Odoo 17How to Handle the Separate Discount Account on Invoice in Odoo 17
How to Handle the Separate Discount Account on Invoice in Odoo 17
Celine George
 
How to Configure Time Off Types in Odoo 17
How to Configure Time Off Types in Odoo 17How to Configure Time Off Types in Odoo 17
How to Configure Time Off Types in Odoo 17
Celine George
 
Split Shifts From Gantt View in the Odoo 17
Split Shifts From Gantt View in the  Odoo 17Split Shifts From Gantt View in the  Odoo 17
Split Shifts From Gantt View in the Odoo 17
Celine George
 
How to Create Sequence Numbers in Odoo 17
How to Create Sequence Numbers in Odoo 17How to Create Sequence Numbers in Odoo 17
How to Create Sequence Numbers in Odoo 17
Celine George
 
Book Allied Health Sciences kmu MCQs.docx
Book Allied Health Sciences kmu MCQs.docxBook Allied Health Sciences kmu MCQs.docx
Book Allied Health Sciences kmu MCQs.docx
drtech3715
 
AI Risk Management: ISO/IEC 42001, the EU AI Act, and ISO/IEC 23894
AI Risk Management: ISO/IEC 42001, the EU AI Act, and ISO/IEC 23894AI Risk Management: ISO/IEC 42001, the EU AI Act, and ISO/IEC 23894
AI Risk Management: ISO/IEC 42001, the EU AI Act, and ISO/IEC 23894
PECB
 
Bedok NEWater Photostory - COM322 Assessment (Story 2)
Bedok NEWater Photostory - COM322 Assessment (Story 2)Bedok NEWater Photostory - COM322 Assessment (Story 2)
Bedok NEWater Photostory - COM322 Assessment (Story 2)
Liyana Rozaini
 
Views in Odoo - Advanced Views - Pivot View in Odoo 17
Views in Odoo - Advanced Views - Pivot View in Odoo 17Views in Odoo - Advanced Views - Pivot View in Odoo 17
Views in Odoo - Advanced Views - Pivot View in Odoo 17
Celine George
 
NAEYC Code of Ethical Conduct Resource Book
NAEYC Code of Ethical Conduct Resource BookNAEYC Code of Ethical Conduct Resource Book
NAEYC Code of Ethical Conduct Resource Book
lakitawilson
 

Recently uploaded (20)

(T.L.E.) Agriculture: Essentials of Gardening
(T.L.E.) Agriculture: Essentials of Gardening(T.L.E.) Agriculture: Essentials of Gardening
(T.L.E.) Agriculture: Essentials of Gardening
 
Is Email Marketing Really Effective In 2024?
Is Email Marketing Really Effective In 2024?Is Email Marketing Really Effective In 2024?
Is Email Marketing Really Effective In 2024?
 
The basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxThe basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptx
 
2024 KWL Back 2 School Summer Conference
2024 KWL Back 2 School Summer Conference2024 KWL Back 2 School Summer Conference
2024 KWL Back 2 School Summer Conference
 
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 12 - GLOBAL SUCCESS - FORM MỚI 2025 - HK1 (C...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 12 - GLOBAL SUCCESS - FORM MỚI 2025 - HK1 (C...CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 12 - GLOBAL SUCCESS - FORM MỚI 2025 - HK1 (C...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 12 - GLOBAL SUCCESS - FORM MỚI 2025 - HK1 (C...
 
SYBCOM SEM III UNIT 1 INTRODUCTION TO ADVERTISING
SYBCOM SEM III UNIT 1 INTRODUCTION TO ADVERTISINGSYBCOM SEM III UNIT 1 INTRODUCTION TO ADVERTISING
SYBCOM SEM III UNIT 1 INTRODUCTION TO ADVERTISING
 
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 
NLC Grade 3.................................... ppt.pptx
NLC Grade 3.................................... ppt.pptxNLC Grade 3.................................... ppt.pptx
NLC Grade 3.................................... ppt.pptx
 
Lecture_Notes_Unit4_Chapter_8_9_10_RDBMS for the students affiliated by alaga...
Lecture_Notes_Unit4_Chapter_8_9_10_RDBMS for the students affiliated by alaga...Lecture_Notes_Unit4_Chapter_8_9_10_RDBMS for the students affiliated by alaga...
Lecture_Notes_Unit4_Chapter_8_9_10_RDBMS for the students affiliated by alaga...
 
Final_SD_Session3_Ferriols, Ador Dionisio, Fajardo.pptx
Final_SD_Session3_Ferriols, Ador Dionisio, Fajardo.pptxFinal_SD_Session3_Ferriols, Ador Dionisio, Fajardo.pptx
Final_SD_Session3_Ferriols, Ador Dionisio, Fajardo.pptx
 
Webinar Innovative assessments for SOcial Emotional Skills
Webinar Innovative assessments for SOcial Emotional SkillsWebinar Innovative assessments for SOcial Emotional Skills
Webinar Innovative assessments for SOcial Emotional Skills
 
How to Handle the Separate Discount Account on Invoice in Odoo 17
How to Handle the Separate Discount Account on Invoice in Odoo 17How to Handle the Separate Discount Account on Invoice in Odoo 17
How to Handle the Separate Discount Account on Invoice in Odoo 17
 
How to Configure Time Off Types in Odoo 17
How to Configure Time Off Types in Odoo 17How to Configure Time Off Types in Odoo 17
How to Configure Time Off Types in Odoo 17
 
Split Shifts From Gantt View in the Odoo 17
Split Shifts From Gantt View in the  Odoo 17Split Shifts From Gantt View in the  Odoo 17
Split Shifts From Gantt View in the Odoo 17
 
How to Create Sequence Numbers in Odoo 17
How to Create Sequence Numbers in Odoo 17How to Create Sequence Numbers in Odoo 17
How to Create Sequence Numbers in Odoo 17
 
Book Allied Health Sciences kmu MCQs.docx
Book Allied Health Sciences kmu MCQs.docxBook Allied Health Sciences kmu MCQs.docx
Book Allied Health Sciences kmu MCQs.docx
 
AI Risk Management: ISO/IEC 42001, the EU AI Act, and ISO/IEC 23894
AI Risk Management: ISO/IEC 42001, the EU AI Act, and ISO/IEC 23894AI Risk Management: ISO/IEC 42001, the EU AI Act, and ISO/IEC 23894
AI Risk Management: ISO/IEC 42001, the EU AI Act, and ISO/IEC 23894
 
Bedok NEWater Photostory - COM322 Assessment (Story 2)
Bedok NEWater Photostory - COM322 Assessment (Story 2)Bedok NEWater Photostory - COM322 Assessment (Story 2)
Bedok NEWater Photostory - COM322 Assessment (Story 2)
 
Views in Odoo - Advanced Views - Pivot View in Odoo 17
Views in Odoo - Advanced Views - Pivot View in Odoo 17Views in Odoo - Advanced Views - Pivot View in Odoo 17
Views in Odoo - Advanced Views - Pivot View in Odoo 17
 
NAEYC Code of Ethical Conduct Resource Book
NAEYC Code of Ethical Conduct Resource BookNAEYC Code of Ethical Conduct Resource Book
NAEYC Code of Ethical Conduct Resource Book
 

Introduction to Visual Basic

  • 2. What is Visual Basic? •The "Visual" part refers to the method used to create the graphical user interface (GUI). Rather than writing numerous lines of code to describe the appearance and location of interface elements, you simply add pre-built objects into place on screen •The "Basic" part refers to the BASIC (Beginners All-Purpose Symbolic Instruction Code) language
  • 3. Visual Basic Characteristics • Rapid Application Development (RAD) tool • Front-end applications. •ActiveX technologies allow you to use the functionality provided by other applications, such as Microsoft Word word processor, Microsoft Excel spreadsheet, and other Windows applications. •Your finished application is a true .exe file.
  • 4. Event-Driven programming Language? In an event-driven application, the code doesn't follow a predetermined path — it executes different code sections in response to events. Events can be triggered by the user's actions, by messages from the system or other applications, or even from the application itself. The sequence of these events determines the sequence in which the code executes, thus the path through the application's code differs each time the program runs. Your code can also trigger events during execution. For example, programmatically changing the text in a text box cause the text box's Change event to occur.
  • 5. Interactive Development The traditional application development process can be broken into three distinct steps: writing, compiling, and testing code. Unlike traditional languages, Visual Basic uses an interactive approach to development, blurring the distinction between the three steps. With most languages, if you make a mistake in writing your code, the error is caught by the compiler when you start to compile your application. You must then find and fix the error and begin the compile cycle again, repeating the process for each error found. Visual Basic interprets your code as you enter it, catching and highlighting most syntax or spelling errors on the fly.
  • 6. In addition to catching errors on the fly, Visual Basic also partially compiles the code as it is entered. If the compiler finds an error, it is highlighted in your code. You can fix the error and continue compiling without having to start over. Because of the interactive nature of Visual Basic, you'll find yourself running your application frequently as you develop it. This way you can test the effects of your code as you work rather than waiting to compile later.
  • 7. The Integrated Development Environment Selecting the Project Type
  • 9. Working with Visual Basic Projects A project consists of : •One project file that keeps track of all the components (.vbp). •One file for each form (.frm). •One binary data file for each form containing data for properties of controls on the form (.frx). These files are not editable and are automatically generated for any .frm file that contains binary properties, such as Picture or Icon. •Optionally, one file for each class module (.cls). •Optionally, one file for each standard module (.bas). The project file is simply a list of all the files and objects associated with the project, as well as information on the environment options you set. You can convert the project into an executable file (.exe)
  • 10. Form Modules Form modules (.frm file name extension) can contain textual descriptions of the form and its controls, including their property settings. They also contain form-level declarations of constants, variables and procedures; event procedures; and general procedures. Class Modules Class modules (.cls file name extension) are similar to form modules, except that they have no visible user interface. You can use class modules to create your own objects, including code for methods and properties. Standard Modules Standard modules (.bas file name extension) can contain public or module-level declarations of types, constants, variables, external procedures, and public procedures.
  • 11. Variables Variable is a placeholder in memory. Variables are used to temporarily store values during the execution of an application. Variables have a name (the word you use to refer to the value the variable contains) and a data type (which determines the kind of data the variable can store). A variable name: •Must begin with a letter. •Can't contain an embedded period. •Must not exceed 255 characters. •Must be unique within the same scope, which is the range from which the variable can be referenced — a procedure, a form, and so on.
  • 12. Implicit Declaration You don't have to declare a variable before using it. Visual Basic automatically creates a variable with that name, which you can use as if you had explicitly declared it. While this is convenient, it can lead to subtle errors in your code if you misspell a variable name. Example: x = “Sam” a = 45 Explicit Declaration To avoid the problem of misnaming variables, you can stipulate that Visual Basic always warn you whenever it encounters a name not declared explicitly as a variable. Place this statement in the Declarations section of a class, form, or
  • 13. Scope of Variables A variable is scoped as either a procedure-level (local) or module- level variable. Scope Procedure-level Private: Variables are private to the procedure in which they appear. Public: Not applicable. You cannot declare public variables within a procedure. Module-level Private: Variables are private to the module in which they appear. Public: Variables are available to all modules.
  • 14. The Variant Data Type Variant variables can hold any type of data described so far, and then some. Variables of this type take 16 bytes, in this format: Bytes 0 and 1 hold an integer value that states which type of data is stored in bytes 8 through 15. Bytes 2 through 7 are unused (with only one exception, the Decimal subtype), and in most cases not all the bytes in the second half of the variable are used. For example, if a Variant holds an Integer value, the first two bytes contain the value 2-vbInteger, bytes 8 and 9 hold the actual 16-bit value, and all other bytes are unused.
  • 15. Variables Used Within a Procedure You declare them with the Dim or Static keywords. For example: Dim intTemp As Integer or Static intPermanent As Integer Variables Used Within a Module You create module-level variables by declaring them with the Private keyword in the Declarations section at the top of the module. Private intTemp As Integer At the module level, there is no difference between Private and Dim, but Private is preferred because it readily contrasts with Public and makes your code easier to understand.
  • 16. Variables Used by All Modules To make a module-level variable available to other modules, use the Public keyword to declare the variable. The values in public variables are available to all procedures in your application. Like all module-level variables, Public variables are declared in the Declarations section at the top of the module. Public intTemp As Integer
  • 17. Constants The syntax for declaring a constant is: [Public|Private] Const constantname[As type] = expression A Const statement can represent a mathematical or date/time quantity: Const conPi = 3.14159 Public Const conMaxPlanets As Integer = 9 Const conReleaseDate = #1/1/95# Const conCodeName = "Enigma" You can place more than one constant declaration on a single line if you separate them with commas: Public Const conPi = 3.14, conMaxPlanets = 9
  • 18. Data Types By default, if you don't supply a data type, the variable is given the Variant data type. The Variant data type can represent many different data types in different situations. Declaring Variables with Data Types You must use Private, Public, Dim or Static statement to declare it As type. Numeric Data Types Visual Basic supplies several numeric data types — Byte, Integer, Long Single (single-precision floating point), Double (double-precision floating point), and Currency.
  • 19. The String Data Type Private S As String S = "Database" You specify a fixed-length string with this syntax: String * size For example, to declare a string that is always 50 characters long, use code like this: Dim EmpName As String * 50 The Boolean Data Type If you have a variable that will contain simple true/false The default value of Boolean is False. Dim blnRunning As Boolean
  • 20. The Date Data Type Date and time values can be contained both in the specific Date data type and in Variant variables. The Object Data Type Object variables are stored as 32-bit (4-byte) addresses that refer to objects within an application or within some other application. A variable declared as Object is one that can subsequently be assigned (using the Set statement) to refer to any actual object recognized by the application.
  • 21. Converting Data Types Conversion functions to convert values into a specific data type. Conversion function Converts an expression to Cbool Boolean Cbyte Byte Ccur Currency Cdate Date CDbl Double Cint Integer CLng Long CSng Single CStr String Cvar Variant
  • 22. Arrays Fixed-Size Arrays When declaring an array, follow the array name by the upper bound in parentheses. The upper bound cannot exceed the range of a Long data type (-2,147,483,648 to 2,147,483,647). For example Dim Counters(14) As Integer ' 15 elements. To specify a lower bound, provide it explicitly using the To keyword: Dim Sums(100 To 120) As String
  • 23. Multidimensional Arrays Dim MatrixA(9, 9) As Double Either or both dimensions can be declared with explicit lower bounds: Dim MatrixA(1 To 10, 1 To 10) As Double
  • 24. Dynamic Arrays A dynamic array can be resized at any time. To create a dynamic array 1. Declare the array as dynamic by giving it an empty dimension list.Dim DynArray() 2. Allocate the actual number of elements with a ReDim statement.ReDim DynArray(X + 1) The ReDim statement can appear only in a procedure. Unlike the Dim and Static statements, ReDim is an executable statement — it makes the application carry out an action at run time. Each ReDim can change the number of elements, as well as the lower and upper bounds. ReDim DynArray(4 to 12)
  • 25. Preserving the Contents of Dynamic Arrays Each time you execute the ReDim statement, all the values currently stored in the array are lost. Sometimes you may want to change the size of the array without losing the data in the array. You can do this by using ReDim with the Preserve keyword. ReDim Preserve DynArray(UBound(DynArray) + 1)
  • 26. User-Defined Types A user-defined type (UDT) is a compound data structure that holds several variables of simpler data types. Before you can use a UDT variable, you must first define its structure, using a Type directive in the declaration section of a module: Private Type EmployeeUDT Name As String Department ID As Long Salary As Double End Type The Type statement can be used only at module level.
  • 27. Private Type EmployeeRecord ' Create user-defined type. ID As Integer ' Define elements of data type. Name As String * 20 Address As String * 30 Phone As Long End Type Private Sub Form_Load() Dim MyRecord As EmployeeRecord ' Declare variable. ' Assignment to EmployeeRecord variable must occur in a procedure. MyRecord.ID = 12003 MsgBox MyRecord.ID End Sub
  • 28. Mathematical Operators Operator Meaning +, - Unary positive, negative + Addition - Subtraction * Multiplication / Division ^ exponentiation Interestingly, the division operator (/) always converts both its operands to Double, which can cause some unexpected overhead. If you're dividing an Integer or Long number by another Integer or Long number and you aren't interested in the decimal part of the quotient, you should use the integer division operator (), which executes faster:
  • 29. Comparison Operators Visual Basic supports six comparison operators, which can be applied to both numeric and string operands: = < <= > >= <> Boolean Visual Basic for Applications supports a few Boolean operators, which are especially useful for combining multiple Boolean subexpressions. The operators used most frequently are AND, OR, XOR, and NOT.
  • 30. Rounding and Truncating The Int function truncates a number to the integer value equal or lower than its argument. Print Int(1.2) ' Displays "1" Print Int(-1.2) ' Displays "-2" The function that actually truncates the decimal part of a number is Fix: Print Fix(1.2) ' Displays "1“ Print Fix(-1.2) ' Displays "-1" Round, which lets you round a decimal number to the number of digits you want (or to the nearest integer, if the second argument is omitted): Print Round(1.45) ' Displays "1" Print Round(1.55) ' Displays "2"
  • 31. Round cont….. When the fractional part is exactly 0.5, it rounds up if the integer portion is an odd number and rounds down if it's even: Print Round(1.5), Round(2.5) ' Both display "2".
  • 32. Breaking a Single Statement Into Multiple Lines You can break a long statement into multiple lines in the Code window using the line-continuation character (a space followed by an underscore). Using this character can make your code easier to read, both online and when printed. S = _ "SELECT * FROM Titles, Publishers" _ & "WHERE Publishers.PubId = Titles.PubID" _ & "AND Publishers.State = 'CA'" You can't follow a line-continuation character with a comment on the same line.
  • 33. Combining Statements on One Line You can place two or more statements on a line if you use a colon (:) to separate them: Text1.Text = "Hello" : Red = 255 In order to make your code more readable, however, it's better to place each statement on a separate line. Adding Comments to Your Code As you read through the examples in this guide, you'll often come across the comment symbol ('). This symbol tells Visual Basic to ignore the words that follow it.
  • 34. Procedures These can be of type Sub or Function, depending on whether they return a value to the caller. Each procedure has a unique name, a scope, a list of expected arguments, and—if it's a function—a return value. Scope can be Private, Public, or Friend. A Private procedure can be invoked only from within the module in which it's defined. A Public procedure can be invoked from outside the module. A Friend procedure is halfway between Private and Public: Such a procedure can be called from anywhere in the current project, but not from outside it. This difference becomes important only if you're within a project of a type other than Standard EXE, one that therefore exposes its classes to other applications in the form of COM components.
  • 35. Control Flow Branch Statements If...Then If condition Then statement If condition Then statements End If If...Then...Else If condition1 Then [statementblock-1] [ElseIf condition2 Then [statementblock-2]] ... [Else [statementblock-n]] End If
  • 36. ' Single line version, without Else clause If x > 0 Then y = x ' Single line version, with Else clause If x > 0 Then y = x Else y = 0 ' Single line, but with multiple statements separated by colons If x > 0 Then y = x: x = 0 Else y = 0
  • 37. ' Multiline version of the above code (more readable) If x > 0 Then y = x x = 0 Else y = 0 End If ' An example of If..ElseIf..Else block If x > 0 Then y = x ElseIf x < 0 Then y = x * x Else ' X is surely 0, no need to actually test it. x = -1 End If
  • 38. Select Case A Select Case statement provides capability similar to the If...Then...Else statement, but it makes code more readable when there are several choices. Select Case testexpression [Case expressionlist1 [statementblock-1]] [Case expressionlist2 [statementblock-2]] . . . [Case Else [statementblock-n]] End Select
  • 39. The Select Case statement is less versatile than the If block in that it can test only one expression against a list of values: Select Case Mid$(Text, i, 1) Case "0" To "9" ' It's a digit. Case "A" To "Z", "a" To "z" ' It's a letter. Case ".", ",", " ", ";", ":", "?" ' It's a punctuation symbol or a space. Case Else ' It's something else. End Select
  • 40. Loop Structures Do While condition statements Loop Do statements Loop While condition Do statements Loop Until condition While condition [statements] Wend
  • 41. For...Next The syntax is: For counter = start To end [Step increment] statements Next [counter] The arguments counter, start, end, and increment are all numeric. For Each...Next Syntax : For Each element In group statements Next element
  • 42. IIf Function Returns one of two parts, depending on the evaluation of an expression. Syntax IIf (expr, truepart, falsepart) expr. Expression you want to evaluate. truepart. Value or expression returned if expr is True. falsepart. Value or expression returned if expr is False. IIf always evaluates both truepart and falsepart, even though it returns only one of them. Because of this, you should watch for undesirable side effects. For example, if evaluating falsepart results in a division by zero error, an error occurs even if expr is True.
  • 43. With Statement Executes a series of statements on a single object or a user defined type. Syntax With object [statements] End With Example: With MyObject .Height = 100 ' Same as MyObject.Height = 100. .Caption = "Hello" ' Same as MyObject.Caption = "Hello". With .Font .Color = Red ' Same as MyObject.Font.Color = Red. .Bold = True ' Same as MyObject.Font.Bold = True. End With