SlideShare a Scribd company logo
Data structures

    in VB.NET




                  1
Processing
Once the data has been entered into the
program, we need to “do something with it”
This is the data processing part
Most of what you want to do to it has been
done before – many times!
There are some standard “structures” that it
is useful to know about


                                               2
How a program runs
Variables have a space reserved in
memory (they are declared and initialised)
They might be given a value
The next lines in the program or part of
the program that is running are read and
executed one at a time



                                             3
Conditional statements
We might want a program to make some
choices based on the data it receives
  e.g. If intAge > 17 then…..
The full syntax in VB is:
  If condition Then
   Line of code to execute
  End If


                                        4
Conditional statements
Don‟t forget the End If!
It is also possible to add another condition,
a kind of „either or‟ choice:
   If condition Then
   Line of code to execute
  Else
   Another line of code if the above
    condition is false
  End If

                                                5
Conditional statements

Whole banks of If…Then statements can be
built up to test for various conditions
If there are many, this can get confusing and
messy
Far better in this case to use the Select Case
statement



                                                 6
Conditional statements

Syntax:
 Select Case variable
        Case possible value or range
            Line of code to execute
       Case another possible value
            Another line of code
 End Select


                                       7
Loop structures
These are used when we want lines of code to
be executed many times
How many times depends on either various
conditions being met or we might want it to
run a set number of times
There are loops for all occasions and
programmers have their favourites!



                                               8
Loop structures
If we want the loop to run a fixed number of
times, we use a For…..Next loop
This will use a variable as a counter
Syntax:
  For first value To last value
   Line of code to execute
  Next value



                                               9
For...Next example




                     10
Loop structures
If you want the loop to carry on an unspecified
number of times until a condition is met,
use a Do….While Loop
  Beware! It is possible to create loops that carry on to
  infinity
  Infinite loops aren‟t the end of world – the computer
  may crash so you might lose some unsaved work
  Pressing Ctrl + Break sometimes works to stop it




                                                            11
Loop structures
Syntax:
   Do While value=whatever
          Line of code to execute
   Loop


Or (my favourite):
   While value=whatever
          Line of code execute
   End While


                                    12
While…End While Example




                          13
Loop structures
Loops can also be nested
This is where it can get really confusing
One loop can search through one set of data
But it can be running inside another loop
This is useful where data is in a table
  One loop deals with rows
  The other deals with columns




                                              14
Loop structures
When nesting loops, it is important to get the
code looking tidy
The best way to do this is with indentation
  The section of code after the first line is tabbed in
  The last line is tabbed out




                                                          15
Code Example
This is a neat piece of code
  (of course, I wrote it )
It contains two loops – an inner and an outer
Can you try to work out what it does?




                                                16
Programming terms

In this session we have covered the three
ways that programs flow
  Sequence – running one line after another
  Selection – using conditional statements
  Iteration – using loops




                                              17

More Related Content

What's hot

File system Os
File system OsFile system Os
File system Os
Nehal Naik
 
Memory Management
Memory ManagementMemory Management
Memory Management
lavanya marichamy
 
Scheduling
SchedulingScheduling
Types of Programming Languages
Types of Programming LanguagesTypes of Programming Languages
Types of Programming Languages
Juhi Bhoyar
 
Introduction to Computer Programming
Introduction to Computer ProgrammingIntroduction to Computer Programming
Introduction to Computer Programming
Prof. Erwin Globio
 
2 PHASE COMMIT PROTOCOL
2 PHASE COMMIT PROTOCOL2 PHASE COMMIT PROTOCOL
2 PHASE COMMIT PROTOCOL
KABILESH RAMAR
 
Programming languages
Programming languagesProgramming languages
Programming languages
Akash Varaiya
 
Lecture 1 introduction to vb.net
Lecture 1   introduction to vb.netLecture 1   introduction to vb.net
Lecture 1 introduction to vb.net
MUKALU STEVEN
 
Course outline of parallel and distributed computing
Course outline of parallel and distributed computingCourse outline of parallel and distributed computing
Course outline of parallel and distributed computing
National College of Business Administration & Economics ( NCBA&E)
 
Linux file system
Linux file systemLinux file system
Linux file system
Md. Tanvir Hossain
 
Different types of Editors in Linux
Different types of Editors in LinuxDifferent types of Editors in Linux
Different types of Editors in Linux
Bhavik Trivedi
 
Computer Programming
Computer ProgrammingComputer Programming
Computer Programming
Syed Zaid Irshad
 
COMPILER DESIGN
COMPILER DESIGNCOMPILER DESIGN
COMPILER DESIGN
Vetukurivenkatashiva
 
Pipes in Windows and Linux.
Pipes in Windows and Linux.Pipes in Windows and Linux.
Pipes in Windows and Linux.
Junaid Lodhi
 
System software
System softwareSystem software
System software
Harsha Sachdeva
 
Introduction to basic programming
Introduction to basic programmingIntroduction to basic programming
Introduction to basic programming
Jordan Delacruz
 
Assembly and Machine Code
Assembly and Machine CodeAssembly and Machine Code
Assembly and Machine Code
Project Student
 
serializability in dbms
serializability in dbmsserializability in dbms
serializability in dbms
Saranya Natarajan
 
Just in-time-compiler
Just in-time-compilerJust in-time-compiler
Just in-time-compiler
mohamedjahidameers
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programming
NSU-Biliran Campus
 

What's hot (20)

File system Os
File system OsFile system Os
File system Os
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
Scheduling
SchedulingScheduling
Scheduling
 
Types of Programming Languages
Types of Programming LanguagesTypes of Programming Languages
Types of Programming Languages
 
Introduction to Computer Programming
Introduction to Computer ProgrammingIntroduction to Computer Programming
Introduction to Computer Programming
 
2 PHASE COMMIT PROTOCOL
2 PHASE COMMIT PROTOCOL2 PHASE COMMIT PROTOCOL
2 PHASE COMMIT PROTOCOL
 
Programming languages
Programming languagesProgramming languages
Programming languages
 
Lecture 1 introduction to vb.net
Lecture 1   introduction to vb.netLecture 1   introduction to vb.net
Lecture 1 introduction to vb.net
 
Course outline of parallel and distributed computing
Course outline of parallel and distributed computingCourse outline of parallel and distributed computing
Course outline of parallel and distributed computing
 
Linux file system
Linux file systemLinux file system
Linux file system
 
Different types of Editors in Linux
Different types of Editors in LinuxDifferent types of Editors in Linux
Different types of Editors in Linux
 
Computer Programming
Computer ProgrammingComputer Programming
Computer Programming
 
COMPILER DESIGN
COMPILER DESIGNCOMPILER DESIGN
COMPILER DESIGN
 
Pipes in Windows and Linux.
Pipes in Windows and Linux.Pipes in Windows and Linux.
Pipes in Windows and Linux.
 
System software
System softwareSystem software
System software
 
Introduction to basic programming
Introduction to basic programmingIntroduction to basic programming
Introduction to basic programming
 
Assembly and Machine Code
Assembly and Machine CodeAssembly and Machine Code
Assembly and Machine Code
 
serializability in dbms
serializability in dbmsserializability in dbms
serializability in dbms
 
Just in-time-compiler
Just in-time-compilerJust in-time-compiler
Just in-time-compiler
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programming
 

Viewers also liked

Data structure and its types
Data structure and its typesData structure and its types
Data structure and its types
Navtar Sidhu Brar
 
DATA STRUCTURES
DATA STRUCTURESDATA STRUCTURES
DATA STRUCTURES
bca2010
 
Using loops
Using loopsUsing loops
Using loops
nicky_walters
 
Data types vbnet
Data types vbnetData types vbnet
Data types vbnet
nicky_walters
 
Decisions
DecisionsDecisions
Decisions
nicky_walters
 
Simple debugging
Simple debuggingSimple debugging
Simple debugging
nicky_walters
 
Design for edp
Design for edpDesign for edp
Design for edp
nicky_walters
 
Software development lifecycle
Software development lifecycleSoftware development lifecycle
Software development lifecycle
nicky_walters
 
Ch 3 event driven programming
Ch 3 event driven programmingCh 3 event driven programming
Ch 3 event driven programming
Chaffey College
 
Ndu06 typesof language
Ndu06 typesof languageNdu06 typesof language
Ndu06 typesof language
nicky_walters
 
Decisions
DecisionsDecisions
Decisions
nicky_walters
 
Design documentation
Design documentationDesign documentation
Design documentation
nicky_walters
 
Simple debugging
Simple debuggingSimple debugging
Simple debugging
nicky_walters
 
Event driven theory
Event driven theoryEvent driven theory
Event driven theory
nickywalters
 
Data types vbnet
Data types vbnetData types vbnet
Data types vbnet
nicky_walters
 
Algorithms
AlgorithmsAlgorithms
Algorithms
nicky_walters
 
Event driven programming amazeballs
Event driven programming amazeballsEvent driven programming amazeballs
Event driven programming amazeballs
MsWillcox
 
Controls
ControlsControls
Controls
nicky_walters
 
Event oriented programming
Event oriented programmingEvent oriented programming
Event oriented programming
Ashwini Awatare
 
(WRK302) Event-Driven Programming
(WRK302) Event-Driven Programming(WRK302) Event-Driven Programming
(WRK302) Event-Driven Programming
Amazon Web Services
 

Viewers also liked (20)

Data structure and its types
Data structure and its typesData structure and its types
Data structure and its types
 
DATA STRUCTURES
DATA STRUCTURESDATA STRUCTURES
DATA STRUCTURES
 
Using loops
Using loopsUsing loops
Using loops
 
Data types vbnet
Data types vbnetData types vbnet
Data types vbnet
 
Decisions
DecisionsDecisions
Decisions
 
Simple debugging
Simple debuggingSimple debugging
Simple debugging
 
Design for edp
Design for edpDesign for edp
Design for edp
 
Software development lifecycle
Software development lifecycleSoftware development lifecycle
Software development lifecycle
 
Ch 3 event driven programming
Ch 3 event driven programmingCh 3 event driven programming
Ch 3 event driven programming
 
Ndu06 typesof language
Ndu06 typesof languageNdu06 typesof language
Ndu06 typesof language
 
Decisions
DecisionsDecisions
Decisions
 
Design documentation
Design documentationDesign documentation
Design documentation
 
Simple debugging
Simple debuggingSimple debugging
Simple debugging
 
Event driven theory
Event driven theoryEvent driven theory
Event driven theory
 
Data types vbnet
Data types vbnetData types vbnet
Data types vbnet
 
Algorithms
AlgorithmsAlgorithms
Algorithms
 
Event driven programming amazeballs
Event driven programming amazeballsEvent driven programming amazeballs
Event driven programming amazeballs
 
Controls
ControlsControls
Controls
 
Event oriented programming
Event oriented programmingEvent oriented programming
Event oriented programming
 
(WRK302) Event-Driven Programming
(WRK302) Event-Driven Programming(WRK302) Event-Driven Programming
(WRK302) Event-Driven Programming
 

Similar to Data structures vb

My final requirement
My final requirementMy final requirement
My final requirement
katrinaguevarra29
 
Switch case and looping jam
Switch case and looping jamSwitch case and looping jam
Switch case and looping jam
JamaicaAubreyUnite
 
Macasu, gerrell c.
Macasu, gerrell c.Macasu, gerrell c.
Macasu, gerrell c.
gerrell
 
Switch case and looping new
Switch case and looping newSwitch case and looping new
Switch case and looping new
aprilyyy
 
Yeahhhh the final requirement!!!
Yeahhhh the final requirement!!!Yeahhhh the final requirement!!!
Yeahhhh the final requirement!!!
olracoatalub
 
Looping and switch cases
Looping and switch casesLooping and switch cases
Looping and switch cases
MeoRamos
 
APP_Unit 1_updated.pptx
APP_Unit 1_updated.pptxAPP_Unit 1_updated.pptx
APP_Unit 1_updated.pptx
gogulram2
 
Switch case looping
Switch case loopingSwitch case looping
Switch case looping
Cherimay Batallones
 
(6) c sharp introduction_advanced_features_part_i
(6) c sharp introduction_advanced_features_part_i(6) c sharp introduction_advanced_features_part_i
(6) c sharp introduction_advanced_features_part_i
Nico Ludwig
 
Survelaine murillo ppt
Survelaine murillo pptSurvelaine murillo ppt
Survelaine murillo ppt
Survelaine Murillo
 
Control structures pyhton
Control structures  pyhtonControl structures  pyhton
Control structures pyhton
Prakash Jayaraman
 
Switch case and looping kim
Switch case and looping kimSwitch case and looping kim
Switch case and looping kim
kimberly_Bm10203
 
basics of python - control_structures_and_debugging.pptx
basics of python - control_structures_and_debugging.pptxbasics of python - control_structures_and_debugging.pptx
basics of python - control_structures_and_debugging.pptx
shopinderjeet
 
Switch case and looping
Switch case and loopingSwitch case and looping
Switch case and looping
aprilyyy
 
JAVASCRIPT PPT [Autosaved].pptx
JAVASCRIPT PPT [Autosaved].pptxJAVASCRIPT PPT [Autosaved].pptx
JAVASCRIPT PPT [Autosaved].pptx
AchieversITAravind
 
Full Stack Online Course in Marathahalli| AchieversIT
Full Stack Online Course in Marathahalli| AchieversITFull Stack Online Course in Marathahalli| AchieversIT
Full Stack Online Course in Marathahalli| AchieversIT
AchieversITAravind
 
Programming in Arduino (Part 2)
Programming in Arduino  (Part 2)Programming in Arduino  (Part 2)
Programming in Arduino (Part 2)
Niket Chandrawanshi
 
CMIS 102 Hands-On Lab Week 4OverviewThis hands-on lab all.docx
CMIS 102 Hands-On Lab Week 4OverviewThis hands-on lab all.docxCMIS 102 Hands-On Lab Week 4OverviewThis hands-on lab all.docx
CMIS 102 Hands-On Lab Week 4OverviewThis hands-on lab all.docx
monicafrancis71118
 
Kaush, Vitali - Title: Exploring the Power of V5 Sensors in Robotics: Enhanci...
Kaush, Vitali - Title: Exploring the Power of V5 Sensors in Robotics: Enhanci...Kaush, Vitali - Title: Exploring the Power of V5 Sensors in Robotics: Enhanci...
Kaush, Vitali - Title: Exploring the Power of V5 Sensors in Robotics: Enhanci...
vitalikaush1
 
C tour Unix
C tour UnixC tour Unix
C tour Unix
Melvin Cabatuan
 

Similar to Data structures vb (20)

My final requirement
My final requirementMy final requirement
My final requirement
 
Switch case and looping jam
Switch case and looping jamSwitch case and looping jam
Switch case and looping jam
 
Macasu, gerrell c.
Macasu, gerrell c.Macasu, gerrell c.
Macasu, gerrell c.
 
Switch case and looping new
Switch case and looping newSwitch case and looping new
Switch case and looping new
 
Yeahhhh the final requirement!!!
Yeahhhh the final requirement!!!Yeahhhh the final requirement!!!
Yeahhhh the final requirement!!!
 
Looping and switch cases
Looping and switch casesLooping and switch cases
Looping and switch cases
 
APP_Unit 1_updated.pptx
APP_Unit 1_updated.pptxAPP_Unit 1_updated.pptx
APP_Unit 1_updated.pptx
 
Switch case looping
Switch case loopingSwitch case looping
Switch case looping
 
(6) c sharp introduction_advanced_features_part_i
(6) c sharp introduction_advanced_features_part_i(6) c sharp introduction_advanced_features_part_i
(6) c sharp introduction_advanced_features_part_i
 
Survelaine murillo ppt
Survelaine murillo pptSurvelaine murillo ppt
Survelaine murillo ppt
 
Control structures pyhton
Control structures  pyhtonControl structures  pyhton
Control structures pyhton
 
Switch case and looping kim
Switch case and looping kimSwitch case and looping kim
Switch case and looping kim
 
basics of python - control_structures_and_debugging.pptx
basics of python - control_structures_and_debugging.pptxbasics of python - control_structures_and_debugging.pptx
basics of python - control_structures_and_debugging.pptx
 
Switch case and looping
Switch case and loopingSwitch case and looping
Switch case and looping
 
JAVASCRIPT PPT [Autosaved].pptx
JAVASCRIPT PPT [Autosaved].pptxJAVASCRIPT PPT [Autosaved].pptx
JAVASCRIPT PPT [Autosaved].pptx
 
Full Stack Online Course in Marathahalli| AchieversIT
Full Stack Online Course in Marathahalli| AchieversITFull Stack Online Course in Marathahalli| AchieversIT
Full Stack Online Course in Marathahalli| AchieversIT
 
Programming in Arduino (Part 2)
Programming in Arduino  (Part 2)Programming in Arduino  (Part 2)
Programming in Arduino (Part 2)
 
CMIS 102 Hands-On Lab Week 4OverviewThis hands-on lab all.docx
CMIS 102 Hands-On Lab Week 4OverviewThis hands-on lab all.docxCMIS 102 Hands-On Lab Week 4OverviewThis hands-on lab all.docx
CMIS 102 Hands-On Lab Week 4OverviewThis hands-on lab all.docx
 
Kaush, Vitali - Title: Exploring the Power of V5 Sensors in Robotics: Enhanci...
Kaush, Vitali - Title: Exploring the Power of V5 Sensors in Robotics: Enhanci...Kaush, Vitali - Title: Exploring the Power of V5 Sensors in Robotics: Enhanci...
Kaush, Vitali - Title: Exploring the Power of V5 Sensors in Robotics: Enhanci...
 
C tour Unix
C tour UnixC tour Unix
C tour Unix
 

More from nicky_walters

Pseudocode flowcharts
Pseudocode flowchartsPseudocode flowcharts
Pseudocode flowcharts
nicky_walters
 
Data types vbnet
Data types vbnetData types vbnet
Data types vbnet
nicky_walters
 
Ndu06 typesof language
Ndu06 typesof languageNdu06 typesof language
Ndu06 typesof language
nicky_walters
 
Event driventheory
Event driventheoryEvent driventheory
Event driventheory
nicky_walters
 
Debugging
DebuggingDebugging
Debugging
nicky_walters
 
Input output
Input outputInput output
Input output
nicky_walters
 
Decisions
DecisionsDecisions
Decisions
nicky_walters
 
Intro to visual studio 2008
Intro to visual studio 2008Intro to visual studio 2008
Intro to visual studio 2008
nicky_walters
 
Input output
Input outputInput output
Input output
nicky_walters
 

More from nicky_walters (9)

Pseudocode flowcharts
Pseudocode flowchartsPseudocode flowcharts
Pseudocode flowcharts
 
Data types vbnet
Data types vbnetData types vbnet
Data types vbnet
 
Ndu06 typesof language
Ndu06 typesof languageNdu06 typesof language
Ndu06 typesof language
 
Event driventheory
Event driventheoryEvent driventheory
Event driventheory
 
Debugging
DebuggingDebugging
Debugging
 
Input output
Input outputInput output
Input output
 
Decisions
DecisionsDecisions
Decisions
 
Intro to visual studio 2008
Intro to visual studio 2008Intro to visual studio 2008
Intro to visual studio 2008
 
Input output
Input outputInput output
Input output
 

Data structures vb

  • 1. Data structures in VB.NET 1
  • 2. Processing Once the data has been entered into the program, we need to “do something with it” This is the data processing part Most of what you want to do to it has been done before – many times! There are some standard “structures” that it is useful to know about 2
  • 3. How a program runs Variables have a space reserved in memory (they are declared and initialised) They might be given a value The next lines in the program or part of the program that is running are read and executed one at a time 3
  • 4. Conditional statements We might want a program to make some choices based on the data it receives e.g. If intAge > 17 then….. The full syntax in VB is: If condition Then Line of code to execute End If 4
  • 5. Conditional statements Don‟t forget the End If! It is also possible to add another condition, a kind of „either or‟ choice: If condition Then Line of code to execute Else Another line of code if the above condition is false End If 5
  • 6. Conditional statements Whole banks of If…Then statements can be built up to test for various conditions If there are many, this can get confusing and messy Far better in this case to use the Select Case statement 6
  • 7. Conditional statements Syntax: Select Case variable Case possible value or range Line of code to execute Case another possible value Another line of code End Select 7
  • 8. Loop structures These are used when we want lines of code to be executed many times How many times depends on either various conditions being met or we might want it to run a set number of times There are loops for all occasions and programmers have their favourites! 8
  • 9. Loop structures If we want the loop to run a fixed number of times, we use a For…..Next loop This will use a variable as a counter Syntax: For first value To last value Line of code to execute Next value 9
  • 11. Loop structures If you want the loop to carry on an unspecified number of times until a condition is met, use a Do….While Loop Beware! It is possible to create loops that carry on to infinity Infinite loops aren‟t the end of world – the computer may crash so you might lose some unsaved work Pressing Ctrl + Break sometimes works to stop it 11
  • 12. Loop structures Syntax: Do While value=whatever Line of code to execute Loop Or (my favourite): While value=whatever Line of code execute End While 12
  • 14. Loop structures Loops can also be nested This is where it can get really confusing One loop can search through one set of data But it can be running inside another loop This is useful where data is in a table One loop deals with rows The other deals with columns 14
  • 15. Loop structures When nesting loops, it is important to get the code looking tidy The best way to do this is with indentation The section of code after the first line is tabbed in The last line is tabbed out 15
  • 16. Code Example This is a neat piece of code (of course, I wrote it ) It contains two loops – an inner and an outer Can you try to work out what it does? 16
  • 17. Programming terms In this session we have covered the three ways that programs flow Sequence – running one line after another Selection – using conditional statements Iteration – using loops 17