Question: Form 1 : Working with Structures and a Structure Array with LINQs: This form will have three events: Load event and two button click events
Form : Working with Structures and a Structure Array with LINQs:
This form will have three events: Load event and two button click events queries
Before you begin working on your code, you need to create a text file and name it Pastries.txt
Each record is composed of the following field:
Item Id First letter indicates category the items is in: M Muffins, D Doughnuts, S Specialty Items.
Item Description
Cost to Produce
Selling Price
Qty on Hand
Qty Sold todate this Month
Sample Records:
MLemon Poppy Seed Muffin,
DGlazed Doughnut,
SBear Claws,
SApple Fritters,
This program is to create a UDT User Defined Type Structure that will define the layout of the records that are found in the Pastries.txt file. The structure name should be Pastry. Each field that exists in the Pastries.txt files records should be included in the Structure. They should be given meaningful names and appropriate data types should be used.
This program will work with a class level structure array named pastries that needs to be created before the events can work with it
Load Event:
Populate the String array from the Pastries.txt file using the ReadAllLines method then...
Set a size for the structure array, pastries using ReDim then...
Populate the structure array, pastries from the String array using a For loop.
First Button Click Event:
This event must use a LINQ to order the pastry items from the structure array, pastries into alphabetical order based on the Item Description. The output should include all six fields for all records in the file.
The query results should be displayed in a DataGridView control. Columns should be given meaningful header text.
Second Button Click Event:
This event must use a LINQ to order the pastry items from the structure array, pastries into descending Selling Price order then Item Description ascending order. The profit for each pastry must be calculated selling price cost to produce The output should include the profit along with Item Id Item Description, and Selling Price.
The query results should be displayed in a DataGridView control. Columns should be given meaningful header text. Visual Basic
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
