SlideShare a Scribd company logo

Create a Structure in VBNet.pptx

Breach_P
Breach_P

This document discusses using structures instead of arrays when different data types need to be stored together. It explains how to define a structure with multiple fields of different data types, create an array of that structure, and then access and assign values to the fields of each structure in the array. An example is given of modifying an existing table to instead use a structure to allow storing a team name along with the other data.

1 of 8
Download to read offline
A problem with
arrays
Data structure of array
 We define an array as :
 Dim myArray (10) as integer
 To set up an integer array of 10 items with default values (= 0)
 Or
 MyArray = new integer(10) {}
 To set up an integer array of 10 items with default values (=0)
 Or
 MyArray = new integer(10) {0,2,4,6,8,10,12,14,16,18}
 To set up an integer array of 10 items with default values in the {}
 For all of these, you can only use a single data type, such as :
Integer
Int16,
Int32
Double
String
You cannot have an array with mixed datatypes
What if we want to use
 CustomerName, OrderCode,NumberOrdered
 CustomerName is probably a STRING
 OrderCode is probably a unique number OR unique Alpha-
numeric
 NumberOrdered is probably an integer.
 Mixed datatypes so cannot use an array.
Create our own data structure
 WORK IN CONSOLE MODE.
 1) Name the structure
 Public Structure MyStructure
 Public field as type
 Public field as type
 Public field as type
 End Structure
) Repeat for as many fields
) as you need, using
) discrete names
If we know how many items
 Create an array of MyStructure for that many items
 If it is 8
 Dim MyStructureArray(8) as MyStructure
To create 8 items in the array with default values.
Remember that to process this you use :
For items = 0 to 7 Zero based index

Recommended

Recruter et fideliser le personnel humanitaire
Recruter et fideliser le personnel humanitaireRecruter et fideliser le personnel humanitaire
Recruter et fideliser le personnel humanitaireAsso Asah
 
КОНЦЕПЦИЯ БРЕНД-ОРИЕНТИРОВАННОГО УПРАВЛЕНИЯ КЛАСТЕРАМИ
КОНЦЕПЦИЯ БРЕНД-ОРИЕНТИРОВАННОГО УПРАВЛЕНИЯ КЛАСТЕРАМИКОНЦЕПЦИЯ БРЕНД-ОРИЕНТИРОВАННОГО УПРАВЛЕНИЯ КЛАСТЕРАМИ
КОНЦЕПЦИЯ БРЕНД-ОРИЕНТИРОВАННОГО УПРАВЛЕНИЯ КЛАСТЕРАМИAleksey Korzun, Ph.D.
 
Realizzazione di un controllore basato su piattaforma robotica Thymio 2.
Realizzazione di un controllore basato su piattaforma robotica Thymio 2.Realizzazione di un controllore basato su piattaforma robotica Thymio 2.
Realizzazione di un controllore basato su piattaforma robotica Thymio 2.anwarNazik
 
Chapter 7.1
Chapter 7.1Chapter 7.1
Chapter 7.1sotlsoc
 
Class notes(week 4) on arrays and strings
Class notes(week 4) on arrays and stringsClass notes(week 4) on arrays and strings
Class notes(week 4) on arrays and stringsKuntal Bhowmick
 
Arrays_in_c++.pptx
Arrays_in_c++.pptxArrays_in_c++.pptx
Arrays_in_c++.pptxMrMaster11
 
Class notes(week 4) on arrays and strings
Class notes(week 4) on arrays and stringsClass notes(week 4) on arrays and strings
Class notes(week 4) on arrays and stringsKuntal Bhowmick
 
Multi dimensional arrays
Multi dimensional arraysMulti dimensional arrays
Multi dimensional arraysAseelhalees
 

More Related Content

Similar to Create a Structure in VBNet.pptx

Similar to Create a Structure in VBNet.pptx (20)

Data structure.pptx
Data structure.pptxData structure.pptx
Data structure.pptx
 
CP Handout#7
CP Handout#7CP Handout#7
CP Handout#7
 
Aj unit2 notesjavadatastructures
Aj unit2 notesjavadatastructuresAj unit2 notesjavadatastructures
Aj unit2 notesjavadatastructures
 
C++ programming (Array)
C++ programming (Array)C++ programming (Array)
C++ programming (Array)
 
9781439035665 ppt ch09
9781439035665 ppt ch099781439035665 ppt ch09
9781439035665 ppt ch09
 
Arrays
ArraysArrays
Arrays
 
Week 11.pptx
Week 11.pptxWeek 11.pptx
Week 11.pptx
 
12. arrays
12. arrays12. arrays
12. arrays
 
Array
ArrayArray
Array
 
Data structure array
Data structure  arrayData structure  array
Data structure array
 
Array
ArrayArray
Array
 
Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm
 
Arrays & Strings
Arrays & StringsArrays & Strings
Arrays & Strings
 
ARRAYS.ppt
ARRAYS.pptARRAYS.ppt
ARRAYS.ppt
 
Chap09
Chap09Chap09
Chap09
 
Csharp4 arrays and_tuples
Csharp4 arrays and_tuplesCsharp4 arrays and_tuples
Csharp4 arrays and_tuples
 
Data Structure In C#
Data Structure In C#Data Structure In C#
Data Structure In C#
 
Arrays In C
Arrays In CArrays In C
Arrays In C
 
An Introduction to Programming in Java: Arrays
An Introduction to Programming in Java: ArraysAn Introduction to Programming in Java: Arrays
An Introduction to Programming in Java: Arrays
 
6.array
6.array6.array
6.array
 

More from Breach_P

Revision of Legal issues for Unit 11.pptx
Revision of Legal issues for Unit 11.pptxRevision of Legal issues for Unit 11.pptx
Revision of Legal issues for Unit 11.pptxBreach_P
 
Unit 2 lo1 2-3
Unit 2 lo1 2-3Unit 2 lo1 2-3
Unit 2 lo1 2-3Breach_P
 
Number base conversion
Number base conversionNumber base conversion
Number base conversionBreach_P
 
Number base conversion (it)
Number base conversion (it)Number base conversion (it)
Number base conversion (it)Breach_P
 
V model of project development
V model of project developmentV model of project development
V model of project developmentBreach_P
 
Hardware devices
Hardware devicesHardware devices
Hardware devicesBreach_P
 
1 3 types_ofcomputersystem
1 3 types_ofcomputersystem1 3 types_ofcomputersystem
1 3 types_ofcomputersystemBreach_P
 
Lo6 student book 1 notes
Lo6 student book 1 notesLo6 student book 1 notes
Lo6 student book 1 notesBreach_P
 
Taraz state pedagogical institute report 3 dec 2014
Taraz state pedagogical institute report 3 dec 2014Taraz state pedagogical institute report 3 dec 2014
Taraz state pedagogical institute report 3 dec 2014Breach_P
 
Using moodle teacher slides
Using moodle teacher slidesUsing moodle teacher slides
Using moodle teacher slidesBreach_P
 
Introduction to moodle
Introduction to moodleIntroduction to moodle
Introduction to moodleBreach_P
 
Different document types
Different document typesDifferent document types
Different document typesBreach_P
 

More from Breach_P (13)

Revision of Legal issues for Unit 11.pptx
Revision of Legal issues for Unit 11.pptxRevision of Legal issues for Unit 11.pptx
Revision of Legal issues for Unit 11.pptx
 
Unit 2 lo1 2-3
Unit 2 lo1 2-3Unit 2 lo1 2-3
Unit 2 lo1 2-3
 
Number base conversion
Number base conversionNumber base conversion
Number base conversion
 
Number base conversion (it)
Number base conversion (it)Number base conversion (it)
Number base conversion (it)
 
V model of project development
V model of project developmentV model of project development
V model of project development
 
Hardware devices
Hardware devicesHardware devices
Hardware devices
 
1 3 types_ofcomputersystem
1 3 types_ofcomputersystem1 3 types_ofcomputersystem
1 3 types_ofcomputersystem
 
Lo6 student book 1 notes
Lo6 student book 1 notesLo6 student book 1 notes
Lo6 student book 1 notes
 
Taraz state pedagogical institute report 3 dec 2014
Taraz state pedagogical institute report 3 dec 2014Taraz state pedagogical institute report 3 dec 2014
Taraz state pedagogical institute report 3 dec 2014
 
Xxx test
Xxx testXxx test
Xxx test
 
Using moodle teacher slides
Using moodle teacher slidesUsing moodle teacher slides
Using moodle teacher slides
 
Introduction to moodle
Introduction to moodleIntroduction to moodle
Introduction to moodle
 
Different document types
Different document typesDifferent document types
Different document types
 

Recently uploaded

Practical Research 1, Lesson 5: DESIGNING A RESEARCH PROJECT RELATED TO DAILY...
Practical Research 1, Lesson 5: DESIGNING A RESEARCH PROJECT RELATED TO DAILY...Practical Research 1, Lesson 5: DESIGNING A RESEARCH PROJECT RELATED TO DAILY...
Practical Research 1, Lesson 5: DESIGNING A RESEARCH PROJECT RELATED TO DAILY...Katherine Villaluna
 
Dr.M.Florence Dayana-Cloud Computing-unit - 4.pdf
Dr.M.Florence Dayana-Cloud Computing-unit - 4.pdfDr.M.Florence Dayana-Cloud Computing-unit - 4.pdf
Dr.M.Florence Dayana-Cloud Computing-unit - 4.pdfDr.Florence Dayana
 
11 CI SINIF SINAQLARI - 10-2023-Aynura-Hamidova.pdf
11 CI SINIF SINAQLARI - 10-2023-Aynura-Hamidova.pdf11 CI SINIF SINAQLARI - 10-2023-Aynura-Hamidova.pdf
11 CI SINIF SINAQLARI - 10-2023-Aynura-Hamidova.pdfAynouraHamidova
 
Permeation enhancer of Transdermal drug delivery system
Permeation enhancer of Transdermal drug delivery systemPermeation enhancer of Transdermal drug delivery system
Permeation enhancer of Transdermal drug delivery systemchetanpatil2572000
 
Managing Choice, Coherence and Specialisation in Upper Secondary Education - ...
Managing Choice, Coherence and Specialisation in Upper Secondary Education - ...Managing Choice, Coherence and Specialisation in Upper Secondary Education - ...
Managing Choice, Coherence and Specialisation in Upper Secondary Education - ...EduSkills OECD
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxdeputymitchell2
 
Decision on Curriculum Change Path: Towards Standards-Based Curriculum in Ghana
Decision on Curriculum Change Path: Towards Standards-Based Curriculum in GhanaDecision on Curriculum Change Path: Towards Standards-Based Curriculum in Ghana
Decision on Curriculum Change Path: Towards Standards-Based Curriculum in GhanaPrince Armah, PhD
 
A TEXTBOOK OF INTELLECTUAL ROPERTY RIGHTS
A TEXTBOOK OF INTELLECTUAL ROPERTY RIGHTSA TEXTBOOK OF INTELLECTUAL ROPERTY RIGHTS
A TEXTBOOK OF INTELLECTUAL ROPERTY RIGHTSDr.M.Geethavani
 
Organic Synthesis and Estimation of Functional Groups
Organic Synthesis and Estimation of Functional GroupsOrganic Synthesis and Estimation of Functional Groups
Organic Synthesis and Estimation of Functional GroupsDr.M.Geethavani
 
Plant Genetic Resources, Germplasm, gene pool - Copy.pptx
Plant Genetic Resources, Germplasm, gene pool - Copy.pptxPlant Genetic Resources, Germplasm, gene pool - Copy.pptx
Plant Genetic Resources, Germplasm, gene pool - Copy.pptxAKSHAYMAGAR17
 
SSC Hindu Religion and Moral Education MCQ Solutions 2024.pdf
SSC Hindu Religion and Moral Education MCQ Solutions 2024.pdfSSC Hindu Religion and Moral Education MCQ Solutions 2024.pdf
SSC Hindu Religion and Moral Education MCQ Solutions 2024.pdfMohonDas
 
spring_bee_bot_creations_erd primary.pdf
spring_bee_bot_creations_erd primary.pdfspring_bee_bot_creations_erd primary.pdf
spring_bee_bot_creations_erd primary.pdfKonstantina Koutsodimou
 
Enhancing MRD Testing in Hematologic Malignancies: When Negativity is a Posit...
Enhancing MRD Testing in Hematologic Malignancies: When Negativity is a Posit...Enhancing MRD Testing in Hematologic Malignancies: When Negativity is a Posit...
Enhancing MRD Testing in Hematologic Malignancies: When Negativity is a Posit...i3 Health
 
Google Ad Grants Services at TechSoup.pdf
Google Ad Grants Services at TechSoup.pdfGoogle Ad Grants Services at TechSoup.pdf
Google Ad Grants Services at TechSoup.pdfTechSoup
 
Digital Footprints to Career Pathways - Building a Strong Professional Online...
Digital Footprints to Career Pathways - Building a Strong Professional Online...Digital Footprints to Career Pathways - Building a Strong Professional Online...
Digital Footprints to Career Pathways - Building a Strong Professional Online...Sue Beckingham
 
Kartik Nair In Media Res Media Component
Kartik Nair In Media Res Media ComponentKartik Nair In Media Res Media Component
Kartik Nair In Media Res Media ComponentInMediaRes1
 
Mycobacteriology update 2024 Margie Morgan.ppt
Mycobacteriology update 2024 Margie Morgan.pptMycobacteriology update 2024 Margie Morgan.ppt
Mycobacteriology update 2024 Margie Morgan.pptMargie Morgan
 

Recently uploaded (20)

Practical Research 1, Lesson 5: DESIGNING A RESEARCH PROJECT RELATED TO DAILY...
Practical Research 1, Lesson 5: DESIGNING A RESEARCH PROJECT RELATED TO DAILY...Practical Research 1, Lesson 5: DESIGNING A RESEARCH PROJECT RELATED TO DAILY...
Practical Research 1, Lesson 5: DESIGNING A RESEARCH PROJECT RELATED TO DAILY...
 
Dr.M.Florence Dayana-Cloud Computing-unit - 4.pdf
Dr.M.Florence Dayana-Cloud Computing-unit - 4.pdfDr.M.Florence Dayana-Cloud Computing-unit - 4.pdf
Dr.M.Florence Dayana-Cloud Computing-unit - 4.pdf
 
Lipids as Biopolymer
Lipids as Biopolymer Lipids as Biopolymer
Lipids as Biopolymer
 
11 CI SINIF SINAQLARI - 10-2023-Aynura-Hamidova.pdf
11 CI SINIF SINAQLARI - 10-2023-Aynura-Hamidova.pdf11 CI SINIF SINAQLARI - 10-2023-Aynura-Hamidova.pdf
11 CI SINIF SINAQLARI - 10-2023-Aynura-Hamidova.pdf
 
Permeation enhancer of Transdermal drug delivery system
Permeation enhancer of Transdermal drug delivery systemPermeation enhancer of Transdermal drug delivery system
Permeation enhancer of Transdermal drug delivery system
 
Managing Choice, Coherence and Specialisation in Upper Secondary Education - ...
Managing Choice, Coherence and Specialisation in Upper Secondary Education - ...Managing Choice, Coherence and Specialisation in Upper Secondary Education - ...
Managing Choice, Coherence and Specialisation in Upper Secondary Education - ...
 
CLUBE PERLINGUAS .
CLUBE PERLINGUAS                        .CLUBE PERLINGUAS                        .
CLUBE PERLINGUAS .
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
Decision on Curriculum Change Path: Towards Standards-Based Curriculum in Ghana
Decision on Curriculum Change Path: Towards Standards-Based Curriculum in GhanaDecision on Curriculum Change Path: Towards Standards-Based Curriculum in Ghana
Decision on Curriculum Change Path: Towards Standards-Based Curriculum in Ghana
 
A TEXTBOOK OF INTELLECTUAL ROPERTY RIGHTS
A TEXTBOOK OF INTELLECTUAL ROPERTY RIGHTSA TEXTBOOK OF INTELLECTUAL ROPERTY RIGHTS
A TEXTBOOK OF INTELLECTUAL ROPERTY RIGHTS
 
Organic Synthesis and Estimation of Functional Groups
Organic Synthesis and Estimation of Functional GroupsOrganic Synthesis and Estimation of Functional Groups
Organic Synthesis and Estimation of Functional Groups
 
Plant Genetic Resources, Germplasm, gene pool - Copy.pptx
Plant Genetic Resources, Germplasm, gene pool - Copy.pptxPlant Genetic Resources, Germplasm, gene pool - Copy.pptx
Plant Genetic Resources, Germplasm, gene pool - Copy.pptx
 
SSC Hindu Religion and Moral Education MCQ Solutions 2024.pdf
SSC Hindu Religion and Moral Education MCQ Solutions 2024.pdfSSC Hindu Religion and Moral Education MCQ Solutions 2024.pdf
SSC Hindu Religion and Moral Education MCQ Solutions 2024.pdf
 
spring_bee_bot_creations_erd primary.pdf
spring_bee_bot_creations_erd primary.pdfspring_bee_bot_creations_erd primary.pdf
spring_bee_bot_creations_erd primary.pdf
 
Enhancing MRD Testing in Hematologic Malignancies: When Negativity is a Posit...
Enhancing MRD Testing in Hematologic Malignancies: When Negativity is a Posit...Enhancing MRD Testing in Hematologic Malignancies: When Negativity is a Posit...
Enhancing MRD Testing in Hematologic Malignancies: When Negativity is a Posit...
 
Google Ad Grants Services at TechSoup.pdf
Google Ad Grants Services at TechSoup.pdfGoogle Ad Grants Services at TechSoup.pdf
Google Ad Grants Services at TechSoup.pdf
 
Digital Footprints to Career Pathways - Building a Strong Professional Online...
Digital Footprints to Career Pathways - Building a Strong Professional Online...Digital Footprints to Career Pathways - Building a Strong Professional Online...
Digital Footprints to Career Pathways - Building a Strong Professional Online...
 
Advance Mobile Application Development class 04
Advance Mobile Application Development class 04Advance Mobile Application Development class 04
Advance Mobile Application Development class 04
 
Kartik Nair In Media Res Media Component
Kartik Nair In Media Res Media ComponentKartik Nair In Media Res Media Component
Kartik Nair In Media Res Media Component
 
Mycobacteriology update 2024 Margie Morgan.ppt
Mycobacteriology update 2024 Margie Morgan.pptMycobacteriology update 2024 Margie Morgan.ppt
Mycobacteriology update 2024 Margie Morgan.ppt
 

Create a Structure in VBNet.pptx

  • 2. Data structure of array  We define an array as :  Dim myArray (10) as integer  To set up an integer array of 10 items with default values (= 0)  Or  MyArray = new integer(10) {}  To set up an integer array of 10 items with default values (=0)  Or  MyArray = new integer(10) {0,2,4,6,8,10,12,14,16,18}  To set up an integer array of 10 items with default values in the {}
  • 3.  For all of these, you can only use a single data type, such as : Integer Int16, Int32 Double String You cannot have an array with mixed datatypes
  • 4. What if we want to use  CustomerName, OrderCode,NumberOrdered  CustomerName is probably a STRING  OrderCode is probably a unique number OR unique Alpha- numeric  NumberOrdered is probably an integer.  Mixed datatypes so cannot use an array.
  • 5. Create our own data structure  WORK IN CONSOLE MODE.  1) Name the structure  Public Structure MyStructure  Public field as type  Public field as type  Public field as type  End Structure ) Repeat for as many fields ) as you need, using ) discrete names
  • 6. If we know how many items  Create an array of MyStructure for that many items  If it is 8  Dim MyStructureArray(8) as MyStructure To create 8 items in the array with default values. Remember that to process this you use : For items = 0 to 7 Zero based index
  • 7. Putting a value into a structure  Array(x,y) = Value (You should know and be able to do this)  To put a value into a structure  MyStructureArray(index) . Fieldname = Value  As we set the structure up as an ARRAY, we use an index to point to the ROW  We then use DOT Notation, (a fullstop) that will display the fields in the structure – select the one you want to work with.  Then assign a value with =value
  • 8. You already have Team Event1 Event2 Event3 LineTotal 1 1 1 3 5 3 2 3 2 7 2 3 2 3 8 How would you modify this to use a structure to allow for TEAM NAME to be entered? Work in a team to discuss what your structure will look like (10 minutes) Then implement it