Develop a Windows Form Application [VB. Net Assignment]

Develop a Windows Form Application that takes a product name and a year and shows the corresponding demand. If the product or the year does not exist, the application throws an exception and an error message. The application can also display a table with demand values for all products and all years. Please see the screenshots below at the bottom of the assignment, where the main form and different input values are shown on the left and corresponding message boxes are shown on the right.

 

1. Design a similar form, name all controls, including the form itself, using proper prefixes and names that make sense.

 

2. On the code page, declare the following at the module level: a list of strings for the products, a list of strings for the years, a sorted list of string type keys and integer type values for the demand, and a table array of type integer for the demand. Do NOT use the word “New” in the list and the sorted list declarations.

 

3. Copy and paste the following function in your code:

    Private Function GetDemand() As Integer(,)

        Return {{205, 220, 245, 230},

        {160, 174, 152, 144},

        {480, 424, 396, 456}}

    End Function

 

4. Create a function that returns a list of strings with the product values. Inside the function, declare a list of string, add the entries “ModelX”, “ModelY”, and “ModelZ” and return this list

 

5. Create a function that returns a list of strings with the year values. Inside the function, declare a list of string, add the entries “2013”, “2014”, “2015”, and “2016” and return the list

 

6. Create a function that returns a sorted list of string type keys and integer type values. Inside the function, declare a new sorted list that has the same structure as the function’s return type. Then, using a nested for loop for populating the sorted list, go through the product list and year list such that the product and year is concatenated together to create a key, and the corresponding demand value from the demand table array is retrieved as the value for this key to be entered to the sorted list

 

7. In the Load event for the form (double-click on the form), populate the demand table array by calling the function from step 3 above, populate product list by calling the function from step 4 above, populate year list by calling the function from step 5 above, and populate the demand sorted list by calling the function from step 6 above.

 

8. Create a sub for handling the Click event of the Show Demand button. In this sub, using a Try-Catch structure check if the product list contains the contents of the product text box and also the year list contains the contents of the year text box. Throwcorresponding exceptions if product or year does not exists and display error messages; otherwise display the demand information in a message box by retrieving it from the sorted list using the concatenation of the product and year information as the key.

 

9. Create a sub for handling the Click event of the Show All Demand button. In this sub, declare a string, and using a for loop append the years in year list to this string, where year values are separated with the constant vbTab (a constant similar to the next line constant vbCrLf). Then, using a nested for loop, go through the list of products and years to keep appending to the string, the name of the product at the beginning of each line, followed by the demand values for each year for that product, again, separated by vbTab. Right after the nested for loop, display the string in a message box.

 

10. Write the code to close the form in the event handler for the close button.

Need a custom answer at your budget?

This assignment has been answered 5 times in private sessions.

Or buy a ready public solution below.

Buy ready solution

Solution previews

© 2020 Codify Tutor. All rights reserved