SlideShare a Scribd company logo
1 of 8
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
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
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

More Related Content

What's hot

Biocon an innovative and integrated bio-pharma company
Biocon   an innovative and integrated bio-pharma companyBiocon   an innovative and integrated bio-pharma company
Biocon an innovative and integrated bio-pharma company
HBJ Capital Services Pvt. Ltd
 
Greggs Financial Analysis
Greggs Financial AnalysisGreggs Financial Analysis
Greggs Financial Analysis
Yang Luo
 
Master Thesis in International Marketing
Master Thesis in International MarketingMaster Thesis in International Marketing
Master Thesis in International Marketing
Joep Van den Brink
 

What's hot (20)

Ratio analysis
Ratio analysisRatio analysis
Ratio analysis
 
Unit 1: Business and Business Environment
Unit 1: Business and Business EnvironmentUnit 1: Business and Business Environment
Unit 1: Business and Business Environment
 
IDLC Finance
IDLC FinanceIDLC Finance
IDLC Finance
 
Finance Assignment Ratio Analysis.
Finance Assignment Ratio Analysis. Finance Assignment Ratio Analysis.
Finance Assignment Ratio Analysis.
 
Sales objective analysis and sales territory analysis hemas holdings (plc), ...
Sales objective analysis and sales territory analysis  hemas holdings (plc), ...Sales objective analysis and sales territory analysis  hemas holdings (plc), ...
Sales objective analysis and sales territory analysis hemas holdings (plc), ...
 
Assignment on financial statement ratio analysis
Assignment on financial statement ratio analysisAssignment on financial statement ratio analysis
Assignment on financial statement ratio analysis
 
Pfizer strategy for internationalization
Pfizer strategy for internationalizationPfizer strategy for internationalization
Pfizer strategy for internationalization
 
Glaxo smith-kline-presentation
Glaxo smith-kline-presentationGlaxo smith-kline-presentation
Glaxo smith-kline-presentation
 
Analysis of Covid19 impact on Sectors of Indian Stock Market
Analysis of Covid19 impact on Sectors of Indian Stock MarketAnalysis of Covid19 impact on Sectors of Indian Stock Market
Analysis of Covid19 impact on Sectors of Indian Stock Market
 
Biocon an innovative and integrated bio-pharma company
Biocon   an innovative and integrated bio-pharma companyBiocon   an innovative and integrated bio-pharma company
Biocon an innovative and integrated bio-pharma company
 
Dialog axiata plc - BBE
Dialog axiata plc - BBEDialog axiata plc - BBE
Dialog axiata plc - BBE
 
Greggs Financial Analysis
Greggs Financial AnalysisGreggs Financial Analysis
Greggs Financial Analysis
 
Master Thesis in International Marketing
Master Thesis in International MarketingMaster Thesis in International Marketing
Master Thesis in International Marketing
 
Hemas Holdings PLC Investor Presentation Q3 2018/19
Hemas Holdings PLC Investor Presentation Q3 2018/19Hemas Holdings PLC Investor Presentation Q3 2018/19
Hemas Holdings PLC Investor Presentation Q3 2018/19
 
Corporate Financial Management Assignment - Ratio Analysis of Hays plc
Corporate Financial Management Assignment - Ratio Analysis of Hays plcCorporate Financial Management Assignment - Ratio Analysis of Hays plc
Corporate Financial Management Assignment - Ratio Analysis of Hays plc
 
When tragedy strikes in supply chain
When tragedy strikes in supply chain When tragedy strikes in supply chain
When tragedy strikes in supply chain
 
Dialog presentation
Dialog presentationDialog presentation
Dialog presentation
 
Performance evaluation of financial position conducted at dynamatic technolog...
Performance evaluation of financial position conducted at dynamatic technolog...Performance evaluation of financial position conducted at dynamatic technolog...
Performance evaluation of financial position conducted at dynamatic technolog...
 
Fa group assignment (2017) dialog axiata plc
Fa group assignment (2017) dialog axiata plcFa group assignment (2017) dialog axiata plc
Fa group assignment (2017) dialog axiata plc
 
Building your company's vision
Building your company's visionBuilding your company's vision
Building your company's vision
 

Similar to Create a Structure in VBNet.pptx

Loops and ArraysObjectivesArrays are a series of elements consi.pdf
Loops and ArraysObjectivesArrays are a series of elements consi.pdfLoops and ArraysObjectivesArrays are a series of elements consi.pdf
Loops and ArraysObjectivesArrays are a series of elements consi.pdf
info309708
 
Chapter 7.1
Chapter 7.1Chapter 7.1
Chapter 7.1
sotlsoc
 
Multi dimensional arrays
Multi dimensional arraysMulti dimensional arrays
Multi dimensional arrays
Aseelhalees
 
java I am trying to run my code but it is not letting me .pdf
java    I am trying to run my code but it is not letting me .pdfjava    I am trying to run my code but it is not letting me .pdf
java I am trying to run my code but it is not letting me .pdf
adinathassociates
 
9781439035665 ppt ch09
9781439035665 ppt ch099781439035665 ppt ch09
9781439035665 ppt ch09
Terry Yoast
 
Homework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdfHomework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdf
aroraopticals15
 

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

Loops and ArraysObjectivesArrays are a series of elements consi.pdf
Loops and ArraysObjectivesArrays are a series of elements consi.pdfLoops and ArraysObjectivesArrays are a series of elements consi.pdf
Loops and ArraysObjectivesArrays are a series of elements consi.pdf
 
Chapter 7.1
Chapter 7.1Chapter 7.1
Chapter 7.1
 
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 strings
 
Arrays_in_c++.pptx
Arrays_in_c++.pptxArrays_in_c++.pptx
Arrays_in_c++.pptx
 
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 strings
 
Multi dimensional arrays
Multi dimensional arraysMulti dimensional arrays
Multi dimensional arrays
 
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
 
java I am trying to run my code but it is not letting me .pdf
java    I am trying to run my code but it is not letting me .pdfjava    I am trying to run my code but it is not letting me .pdf
java I am trying to run my code but it is not letting me .pdf
 
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
 
Homework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdfHomework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdf
 

More from Breach_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

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Our Environment Class 10 Science Notes pdf
Our Environment Class 10 Science Notes pdfOur Environment Class 10 Science Notes pdf
Our Environment Class 10 Science Notes pdf
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111
 
Economic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesEconomic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food Additives
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 

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